SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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;
share|improve this question

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.