Monday, July 18, 2011

No Left Navigation on New Web Part Pages

I found it a bit frustrating to manually add the left navigation to every new web parts page created in Sharepoint 2010. The manual process includes commenting out two chunks of code in each web parts page created which I figured out with the help of this site: http://blogs.technet.com/b/seanearp/archive/2011/03/09/how-to-create-a-sharepoint-2010-web-part-page-that-inherits-the-site-s-left-navigation.aspx. I knew there had to be a way to do it once for all new web parts pages.

  1. Connect to your Sharepoint 2010 server.
  2. Navigate to: Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\1033\STS\DOCTEMP\SMARTPGS
  3. Open your site in Microsoft Sharepoint Designer.
  4. Open each of the eight spstd?.aspx files in Microsoft Sharepoint Designer.
  5. Comment out the following lines using "<%--" at the beginning and "--%>" at the end:

    (at approximately line 32)
    <style type="text/css">
    body #s4-leftpanel {
     display:none;
    }
    .s4-ca {
     margin-left:0px;
    }
    </style>
    
    and (at approximately line 56)
    <asp:content contentplaceholderid="PlaceHolderNavSpacer" runat="server"></asp:content>
    <asp:content contentplaceholderid="PlaceHolderLeftNavBar" runat="server"></asp:content>
  6. Save each spstd?.aspx file.
Now the left navigation will be visible by default on all new web parts pages, but still give you the ability to manually hide it by removing the comment from specific files.

No comments:

Post a Comment