PotalSiteMapProvider doesn't return pages
PotalSiteMapProvider doesn't return pages. I use the code as follows:
PortalSiteMapProvider prov = PortalSiteMapProvider.CurrentNavSiteMapProviderNoEncode;
prov.DynamicChildLimit = 0;
prov.IncludeSubSites = PortalSiteMapProvider.IncludeOption.Always;
prov.IncludePages = PortalSiteMapProvider.IncludeOption.Always;
开发者_高级运维 prov.IncludeHeadings = true;
prov.IncludeAuthoredLinks = true;
SiteMapNode root = prov.RootNode;
//prov.IncludePages = PortalSiteMapProvider.IncludeOption.Always;
SiteMapNodeCollection collection = prov.GetChildNodes(root);
foreach (SiteMapNode thisNode in collection)
{
SiteMapNodeCollection thisCollection;
if (thisNode.GetType() == typeof(PortalWebSiteMapNode))
{
prov.IncludePages = PortalSiteMapProvider.IncludeOption.Always;
thisCollection = prov.GetChildNodes((PortalWebSiteMapNode)thisNode);
}
}
As I look it through debugger, thisCollection never has any children, though thisNode is a SubSite Node that has pages. What am I doing wrong and how can I get pages, that are in that node? Thanks!
This is the code I used in a project awhile back. It seemed to pull subpages properly for me.
PortalSiteMapProvider portalProvider = (PortalSiteMapProvider)SiteMap.Providers["CurrentNavSiteMapProviderNoEncode"];
PortalSiteMapNode currentNode = portalProvider.CurrentNode as PortalSiteMapNode;
foreach (SiteMapNode childNode in currentNode.ChildNodes) {
...
}
精彩评论