seo: /root/System/PageName, /root/QueryString/categoryId -> are empty, blank, null, missing
I banged my head for entirely too long on this, so I'm contributing/affirming. In short, if you're invoking your XMLPackage from your master template via a Token call, none of the necessary parameters are passed to the package.
webopius is right:
I think this is because ShowCategory.aspx.cs is using the ShowEntityPage class to render its content and ShowEntityPage adds the additional runtime params.
He suggested two great ways to fix this, but I wanted to keep my primary nav in the master page (rather than moving to ShowXXXXX.aspx.cs) and I wanted my solution to work for all entity types. I also didn't want to replicate the RunTimeParms buildup that's already handled in the ShowEntityPage (see line 251) by adding my own XsltExtension (though an elegant solution and probably best for source-code parity).
Instead, (b/c I had the source), I simply made the RunTimeParms a public property of the master page and pass it all the back up from the ShowEntityPage...
Code:
RunTimeParms = String.Format("EntityName={0}&EntityID={1}", m_EntitySpecs.m_EntityName, m_EntityInstanceID.ToString());
RunTimeParms += String.Format("&CatID={0}", CommonLogic.IIF(m_EntitySpecs.m_EntityName.Trim().Equals("CATEGORY", StringComparison.InvariantCultureIgnoreCase), m_EntityInstanceID.ToString(), m_CategoryFilterID.ToString()));
RunTimeParms += String.Format("&SecID={0}", CommonLogic.IIF(m_EntitySpecs.m_EntityName.Trim().Equals("SECTION", StringComparison.InvariantCultureIgnoreCase), m_EntityInstanceID.ToString(), m_SectionFilterID.ToString()));
RunTimeParms += String.Format("&ManID={0}", CommonLogic.IIF(m_EntitySpecs.m_EntityName.Trim().Equals("MANUFACTURER", StringComparison.InvariantCultureIgnoreCase), m_EntityInstanceID.ToString(), m_ManufacturerFilterID.ToString()));
RunTimeParms += String.Format("&DistID={0}", CommonLogic.IIF(m_EntitySpecs.m_EntityName.Trim().Equals("DISTRIBUTOR", StringComparison.InvariantCultureIgnoreCase), m_EntityInstanceID.ToString(), m_DistributorFilterID.ToString()));
RunTimeParms += String.Format("&GenreID={0}", CommonLogic.IIF(m_EntitySpecs.m_EntityName.Trim().Equals("GENRE", StringComparison.InvariantCultureIgnoreCase), m_EntityInstanceID.ToString(), m_GenreFilterID.ToString()));
RunTimeParms += String.Format("&VectorID={0}", CommonLogic.IIF(m_EntitySpecs.m_EntityName.Trim().Equals("VECTOR", StringComparison.InvariantCultureIgnoreCase), m_EntityInstanceID.ToString(), m_VectorFilterID.ToString()));
RunTimeParms += String.Format("&ProductTypeFilterID={0}", m_ProductTypeFilterID.ToString());
if(sender.GetType().BaseType.BaseType == typeof(SkinBase))
((MasterPageBase)((SkinBase)sender).Master).RunTimeParms = RunTimeParms;
which can then be passed back down to any Token-invoked packages that need it...
Code:
string expression = string.Format("{0},{1},{2}", "XMLPACKAGE", "rev.departments.xml.config", RunTimeParms);
litSectionNav.Text = Tokens.GetEvalData(expression, this.GetType(), string.Empty).ToString();
BUT, I'm pretty new to ASPDNSF, so please correct me is this seem ill-guided.
However, it's super-handy in this case where I might also want to pass this data up from other pages. For example, if I'm on a product page (ShowProduct.aspx) where there is no entity info, I might want my nav to recall which entity I came from and keep that section/category expanded, so I can do this...
Code:
((MasterPageBase)this.Master).RunTimeParms = String.Format("EntityName={0}&EntityID={1}", SourceEntity, SourceEntityID);