Monday, February 2, 2009

How To: Manipulate Navigation Settings Programmatically

__ Global navigation



__ Current navigation



Global navigation

1) web.Navigation.UseShared = true; web.Update();
2) web.Navigation.UseShared = false; web.Update();

Current navigation

1) publishingWeb.InheritCurrentNavigation = true;
publishingWeb.NavigationShowSiblings = false;
publishingWeb.Update();

2) publishingWeb.InheritCurrentNavigation = false;
publishingWeb.NavigationShowSiblings = true;
publishingWeb.Update();

3) publishingWeb.InheritCurrentNavigation = false;
publishingWeb.NavigationShowSiblings = false;
publishingWeb.Update();

Note: InheritCurrentNavigations value is "false" by default.

PS. Thanks to Robin's post for pointing me in the right direction and for his help ;)

3 comments:

Robin Meuré said...

Hi Sven,

You're welcome ;) Though you did the problemsolving yourself!

Robin

Steve Ruiz said...

perfect reference material here -- short and sweet without sacrificing any detail. Thanks!

Steve Ruiz said...

Perfect example of reference material here. Short and sweet without sacrificing any detail. Thanks!