1

I have created variance with English and German and its reference URL is added in current and global navigation. I want to update title of variance site in current and global navigation. How to do that?

SPNavigationNodeCollection quickLaunchNav1 = web.Navigation.QuickLaunch;
                        PortalSiteMapProvider sitemapprovider = (PortalSiteMapProvider)SiteMap.Providers["CurrentNavSiteMapProvider"];
                        SiteMapNode rootNode = sitemapprovider.CurrentNode;


                        if (rootNode.ChildNodes.Count > 0)
                        {
                            foreach (SiteMapNode childNode in rootNode.ChildNodes)
                            {
                                if (childNode.Title.Equals("de-de"))
                                {
                                    childNode.Title = "Test";

                                }
                            }
                        }

But in child node there is not any property of update. How to update title of child node?

1

Instead of trying to alter the sitemap provider node, just change the QuickLaunch node like this:

SPNavigationNodeCollection nodes = web.Navigation.QuickLaunch;
foreach (SPNavigationNode node in nodes)
{
    if (node.Title.Equals("de-de"))
    {
        node.Title = "Test";
        node.Update();
    }
}
0

But en-us and de-de site-node is not available in nodes collection.Don't know why it was not coming on loop.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.