We are trying to build a Custom Navigation Web Control to handle our Global Navigation.

The below code works fine until the subsites have "Display the same navigation items as the parent site" set. Then the result is blank.

PortalSiteMapProvider oMap = PortalSiteMapProvider.GlobalNavSiteMapProvider;

foreach (SiteMapNode node in oMap.CurrentNode.ChildNodes)
    // add the children of the root site
    htmlOutput += renderTopLevelLink(node, isfirst, currUrl);
    isfirst = false;

When "Display the same..." is set, how can I retrieve the parent navigation node?

I've tried using the FindSiteMapNode(oWeb.Url) but the result is my Root Navigation.

P.S. I get the oWeb.Url this way:

protected SPWeb GetNavigationWeb(SPWeb oWeb)
    if (oWeb.Navigation.UseShared == true)
        oWeb = GetNavigationWeb(oWeb.ParentWeb);
    return oWeb;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.