#region
Navigation for ProfileInformation
XmlSiteMap objXmlSiteMapProfileInfo = new XmlSiteMap();
SiteMapNode objSiteMapNodeProfile = new SiteMapNode();
objSiteMapNodeProfile.Title =
"ProfileInformation";
SiteMapNode obj2SiteMapNodeProfile = new SiteMapNode();
obj2SiteMapNodeProfile.Title =
"Profile Information";
obj2SiteMapNodeProfile.ActionName =
"Profile";
obj2SiteMapNodeProfile.ControllerName =
"ProfileInfo";
objSiteMapNodeProfile.ChildNodes.Add(obj2SiteMapNodeProfile);
objXmlSiteMapProfileInfo.RootNode.ChildNodes.Add(objSiteMapNodeProfile);
filterContext.Controller.ViewData["expert.nlqt.profileInfor"] = objXmlSiteMapProfileInfo;
#endregion
----- It's ok. -----
But, when i added "RouteValues". For example, i wanted to get all categorys with all products
private
static SiteMapNode GetCategorysBy_Admin()
{
SiteMapNode objSiteMapNode = new SiteMapNode();
objSiteMapNode.Title =
"Category";
SiteMapNode objSiteMapNodeLevel1, objSiteMapNodeLevel2;
ExpertNLQT_DBsDataContext context = new ExpertNLQT_DBsDataContext();
var categoryList = (from c in context.vw_GetCategorysBy_UserNames select c).ToList();
foreach (vw_GetCategorysBy_UserName category in categoryList)
{
objSiteMapNodeLevel1 =
new SiteMapNode();
objSiteMapNodeLevel1.Title = category.CategoryName;
var products = (from p in context.Tbl_Product where t.FK_NewsCategoryID == category.CategoryID
select p).ToList();
foreach (Tbl_Product objProduct in products)
{
objSiteMapNodeLevel2 =
new SiteMapNode();
objSiteMapNodeLevel2.Title = objProduct.Name;
objSiteMapNodeLevel2.ActionName = objProduct.Action;
objSiteMapNodeLevel2.ControllerName = category.Controller;
objSiteMapNodeLevel2.RouteValues.Add(
"acnm", objProduct.Action);
objSiteMapNodeLevel1.ChildNodes.Add(objSiteMapNodeLevel2);
}
objSiteMapNode.ChildNodes.Add(objSiteMapNodeLevel1);
}
return objSiteMapNode;
}
And my problem is when i click on chill items on panelBar has RouteValues, it'll not expand parent node. How can i fix it.
Thanks
P/S: Sorry if my language is too bad.