SPNavigationNode.IsVisible property not working in sharepoint as expected.

Posted by Manish on Stack Overflow See other posts from Stack Overflow or by Manish
Published on 2010-04-12T18:09:14Z Indexed on 2010/04/14 9:03 UTC
Read the original article Hit count: 233

Filed under:
|
|

I want to hide a quick launch node in a sharepoint site, but it's not working as expected. :(

My code is as under:

                using (SPSite spSiteTest = new SPSite(serverUrl))
                {

                    using (SPWeb mySite = spSiteTest.OpenWeb())
                {
                    SPNavigationNodeCollection quickLaunchNodes = mySite.Navigation.QuickLaunch;

                    SPNavigationNode navQuickNode = new SPNavigationNode("Title", "www.stackoverflow.com", true);


                    foreach (SPNavigationNode node in quickLaunchNodes)
                    {
                        if (node.Title == navQuickNode.Title)
                        {
                            node.Url = navQuickNode.Url;
                            node.IsVisible = isVisible;
                            node.Update();
                            //mySite.Update();
                            return;
                        }
                    }   

                    quickLaunchNodes.AddAsFirst(navQuickNode);

                }
            }

Am I missing something or is it a bug?

© Stack Overflow or respective owner

Related posts about sharepoint

Related posts about .NET