ICmsUrlContext.GetSiteMapNode returns only nodes that Naviga

Posted by Community Admin on 04-Aug-2018 17:57

ICmsUrlContext.GetSiteMapNode returns only nodes that Navigable

All Replies

Posted by Community Admin on 01-Aug-2013 00:00

I'm using SF 3.7.

I have a method that returns the CmsSiteMapNode of the given url, but when traversing the children of this node only nodes marked as Navigable are returned in the collection of children. How can I pull all children, Navigable and non-Navigable, of a CmsSiteMapNode?

ICmsUrlContext context = UrlHelper.GetUrl(UrlPath.ResolveUrl(url), true);
var node = context.GetSiteMapNode() as CmsSiteMapNode;
var childrenNodes = node.ChildNodes;

Posted by Community Admin on 07-Aug-2013 00:00

bump

Posted by Community Admin on 07-Aug-2013 00:00

I figured it out. When trying to get the children from a CmsSiteMapNode I call GetChildNodes from the provider of the CmsSiteMapNode, passing SiteMapDisplayMode.All as the second argument.

var provider = (CmsSiteMapProvider)cmsNode.Provider;
foreach(CmsSiteMapNode child in provider.GetChildNodes(cmsNode, SiteMapDisplayMode.All))
    ....

This thread is closed