Friday, June 1, 2012

Display or Hide Quick Launch SharePoint 2010

In this article we will check how to show or hide quick launch programmatically using SharePoint 2010 object model. In my last article we have checked Causes of Performance issues in SharePoint 2010.

Quick launch usually appears in the left side of a web site as shown in the figure below:
Display or Hide Quick Launch through Browser:
We can display or hide quick launch through browser. To do this Open the site the browser and go to  Site Actions and then Site Settings.

Then from the Look and Feel, click Tree view as shown in the figure below:
Inside the Tree view control you can check or Uncheck the Enable Quick Launch check box. By default it is checked means by default Quick Launch is enabled. See the figure for refrence.
Display or Hide Quick Launch through Programmatically:
Here is the code to Display or Hide Quick Launch through Programmatically.

 SPWeb web = SPContext.Current.Site.RootWeb;
 {
web.QuickLaunchEnabled = false;
 }