Hiding Left Nav

user1155
  • Hiding Left Nav user1155

    I am trying to hide the left nav on secondary pages in my SP 2010 pub site. I can do it just fine with an tag around the nav table, but then on the secondary pages it doesn't hold it's width when it does display. I put an image in there below the nav to hold the width and it does, but it does not disappear on any page with the . Any thoughts?

        <asp:ContentPlaceHolder ID="LeftNavTableCell" runat="server">
            <table cellpadding="0" cellspacing="0" id="LeftNav">
                <tr>
                    <td style="width:301px; text-align:left; vertical-align:top; background-color:#daf1fe;">
        <div class="body-wrapper" style="left: 0px; top: 0px; ">
                <a name="startNavigation"></a>
                                                        <asp:ContentPlaceHolder id="PlaceHolderNavSpacer" runat="server" />
                    <div id="s4-leftpanel" class="s4-notdlg">
                    <div id="s4-leftpanel-content">
                        <asp:ContentPlaceHolder id="PlaceHolderLeftNavBarDataSource" runat="server" />
                        <asp:ContentPlaceHolder id="PlaceHolderCalendarNavigator" runat="server" />
                        <asp:ContentPlaceHolder id="PlaceHolderLeftActions" runat="server"></asp:ContentPlaceHolder>
                            <asp:ContentPlaceHolder id="PlaceHolderLeftNavBarTop" runat="server"/>
                        <asp:ContentPlaceHolder id="PlaceHolderLeftNavBar" runat="server">
                <div class="ms-quicklaunchouter">
                <div class="ms-quickLaunch">
                <asp:ContentPlaceHolder id="PlaceHolderQuickLaunchTop" runat="server">
                <SharePoint:UIVersionedContent UIVersion="3" runat="server">
                    <ContentTemplate>
                        <h3 class="ms-standardheader"><label class="ms-hidden"><SharePoint:EncodedLiteral runat="server" text="<%$Resources:wss,quiklnch_pagetitle%>" EncodeMethod="HtmlEncode"/></label>
                        <Sharepoint:SPSecurityTrimmedControl runat="server" PermissionsString="ViewFormPages">
                            <div class="ms-quicklaunchheader"><SharePoint:SPLinkButton id="idNavLinkViewAll" runat="server" NavigateUrl="~site/_layouts/viewlsts.aspx" Text="<%$Resources:wss,quiklnch_allcontent%>" accesskey="<%$Resources:wss,quiklnch_allcontent_AK%>"/></div>
                        </SharePoint:SPSecurityTrimmedControl>
                        </h3>
                    </ContentTemplate>
                </SharePoint:UIVersionedContent>
                </asp:ContentPlaceHolder>
                <Sharepoint:SPNavigationManager
                id="QuickLaunchNavigationManager"
                runat="server"
                QuickLaunchControlId="QuickLaunchMenu"
                ContainedControl="QuickLaunch"
                EnableViewState="false"
                CssClass="ms-quicklaunch-navmgr">
                <div>
                    <SharePoint:DelegateControl runat="server"
                        ControlId="QuickLaunchDataSource">
                     <Template_Controls>
                        <asp:SiteMapDataSource
                        SiteMapProvider="SPNavigationProvider"
                        ShowStartingNode="False"
                        id="QuickLaunchSiteMap"
                        StartingNodeUrl="sid:1025"
                        runat="server"
                        />
                     </Template_Controls>
                    </SharePoint:DelegateControl>
            <SharePoint:UIVersionedContent UIVersion="3" runat="server">
                <ContentTemplate>
                    <SharePoint:AspMenu
                        id="QuickLaunchMenu"
                        runat="server"
                        DataSourceId="QuickLaunchSiteMap"
                        Orientation="Vertical"
                        StaticDisplayLevels="2"
                        ItemWrap="true"
                        MaximumDynamicDisplayLevels="0"
                        StaticSubMenuIndent="0"
                        SkipLinkText=""
                        CssClass="s4-die"
                        >
                        <LevelMenuItemStyles>
                            <asp:MenuItemStyle CssClass="ms-navheader"/>
                            <asp:MenuItemStyle CssClass="ms-navitem"/>
                        </LevelMenuItemStyles>
                        <LevelSubMenuStyles>
                            <asp:SubMenuStyle CssClass="ms-navSubMenu1"/>
                            <asp:SubMenuStyle CssClass="ms-navSubMenu2"/>
                        </LevelSubMenuStyles>
                        <LevelSelectedStyles>
                            <asp:MenuItemStyle CssClass="ms-selectednavheader"/>
                            <asp:MenuItemStyle CssClass="ms-selectednav"/>
                        </LevelSelectedStyles>
                    </SharePoint:AspMenu>
                </ContentTemplate>
            </SharePoint:UIVersionedContent>
            <SharePoint:UIVersionedContent UIVersion="4" runat="server">
                <ContentTemplate>
                    <SharePoint:AspMenu
                      id="V4QuickLaunchMenu"
                      runat="server"
                      EnableViewState="false"
                      DataSourceId="QuickLaunchSiteMap"
                      UseSimpleRendering="true"
                      UseSeparateCss="false"
                      Orientation="Vertical"
                      StaticDisplayLevels="2"
                      MaximumDynamicDisplayLevels="0"
                      SkipLinkText=""
                      CssClass="customLeft" />
                </ContentTemplate>
            </SharePoint:UIVersionedContent>
                </div>
                </Sharepoint:SPNavigationManager>
            <Sharepoint:UIVersionedContent runat="server" UIVersion="3">
                <ContentTemplate>
                    <Sharepoint:SPNavigationManager
                    id="TreeViewNavigationManager"
                    runat="server"
                    ContainedControl="TreeView"
                    >
                      <table class="ms-navSubMenu1" cellpadding="0" cellspacing="0" border="0">
                        <tr>
                          <td>
                            <table class="ms-navheader" width="100%" cellpadding="0" cellspacing="0" border="0">
                              <tr>
                                <td nowrap="nowrap" id="idSiteHierarchy">
                                  <SharePoint:SPLinkButton runat="server" NavigateUrl="~site/_layouts/viewlsts.aspx" id="idNavLinkSiteHierarchy" Text="<%$Resources:wss,treeview_header%>" accesskey="<%$Resources:wss,quiklnch_allcontent_AK%>"/>
                                </td>
                              </tr>
                            </table>
                          </td>
                        </tr>
                      </table>
                      <div class="ms-treeviewouter">
                        <SharePoint:DelegateControl runat="server" ControlId="TreeViewAndDataSource">
                          <Template_Controls>
                            <SharePoint:SPHierarchyDataSourceControl
                             runat="server"
                             id="TreeViewDataSource"
                             RootContextObject="Web"
                             IncludeDiscussionFolders="true"
                            />
                            <SharePoint:SPRememberScroll runat="server" id="TreeViewRememberScroll" onscroll="javascript:_spRecordScrollPositions(this);" style="overflow: auto;height: 400px;width: 150px; ">
                              <Sharepoint:SPTreeView
                                id="WebTreeView"
                                runat="server"
                                ShowLines="false"
                                DataSourceId="TreeViewDataSource"
                                ExpandDepth="0"
                                SelectedNodeStyle-CssClass="ms-tvselected"
                                NodeStyle-CssClass="ms-navitem"
                                NodeStyle-HorizontalPadding="2"
                                SkipLinkText=""
                                NodeIndent="12"
                                ExpandImageUrl="/_layouts/images/tvplus.gif"
                                CollapseImageUrl="/_layouts/images/tvminus.gif"
                                NoExpandImageUrl="/_layouts/images/tvblank.gif"
                              >
                              </Sharepoint:SPTreeView>
                            </Sharepoint:SPRememberScroll>
                          </Template_Controls>
                        </SharePoint:DelegateControl>
                      </div>
                    </Sharepoint:SPNavigationManager>
                </ContentTemplate>
            </SharePoint:UIVersionedContent>
            <Sharepoint:UIVersionedContent runat="server" UIVersion="4">
                <ContentTemplate>
                    <Sharepoint:SPNavigationManager
                    id="TreeViewNavigationManagerV4"
                    runat="server"
                    ContainedControl="TreeView"
                    CssClass="s4-treeView"
                    >
                      <SharePoint:SPLinkButton runat="server" NavigateUrl="~site/_layouts/viewlsts.aspx" id="idNavLinkSiteHierarchyV4" Text="<%$Resources:wss,treeview_header%>" accesskey="<%$Resources:wss,quiklnch_allcontent_AK%>" CssClass="s4-qlheader" />
                          <div class="ms-treeviewouter">
                            <SharePoint:DelegateControl runat="server" ControlId="TreeViewAndDataSource">
                              <Template_Controls>
                                <SharePoint:SPHierarchyDataSourceControl
                                 runat="server"
                                 id="TreeViewDataSourceV4"
                                 RootContextObject="Web"
                                 IncludeDiscussionFolders="true"
                                />
                                <SharePoint:SPRememberScroll runat="server" id="TreeViewRememberScrollV4" onscroll="javascript:_spRecordScrollPositions(this);" style="overflow: auto;height: 400px;width: 155px; ">
                                  <Sharepoint:SPTreeView
                                    id="WebTreeViewV4"
                                    runat="server"
                                    ShowLines="false"
                                    DataSourceId="TreeViewDataSourceV4"
                                    ExpandDepth="0"
                                    SelectedNodeStyle-CssClass="ms-tvselected"
                                    NodeStyle-CssClass="ms-navitem"
                                    SkipLinkText=""
                                    NodeIndent="12"
                                    ExpandImageUrl="/_layouts/images/tvclosed.png"
                                    ExpandImageUrlRtl="/_layouts/images/tvclosedrtl.png"
                                    CollapseImageUrl="/_layouts/images/tvopen.png"
                                    CollapseImageUrlRtl="/_layouts/images/tvopenrtl.png"
                                    NoExpandImageUrl="/_layouts/images/tvblank.gif"
                                  >
                                  </Sharepoint:SPTreeView>
                                </Sharepoint:SPRememberScroll>
                              </Template_Controls>
                            </SharePoint:DelegateControl>
                          </div>
                    </Sharepoint:SPNavigationManager>
                </ContentTemplate>
            </SharePoint:UIVersionedContent>
                <asp:ContentPlaceHolder id="PlaceHolderQuickLaunchBottom" runat="server">
                <SharePoint:UIVersionedContent UIVersion="3" runat="server" id="PlaceHolderQuickLaunchBottomV3">
                    <ContentTemplate>
                        <table width="100%" cellpadding="0" cellspacing="0" border="0" class="s4-die">
                        <tbody>
                        <tr><td>
                        <table class="ms-recyclebin" width="100%" cellpadding="0" cellspacing="0" border="0">
                        <tbody>
                        <tr><td nowrap="nowrap">
                        <SharePoint:SPLinkButton runat="server" NavigateUrl="~site/_layouts/recyclebin.aspx" id="v3idNavLinkRecycleBin" ImageUrl="/_layouts/images/recycbin.gif" Text="<%$Resources:wss,StsDefault_RecycleBin%>" PermissionsString="DeleteListItems" />
                        </td></tr>
                        </table>
                        </td></tr>
                        </table>
                    </ContentTemplate>
                </SharePoint:UIVersionedContent>
                <SharePoint:UIVersionedContent UIVersion="4" runat="server" id="PlaceHolderQuickLaunchBottomV4">
                    <ContentTemplate>
                        <ul class="s4-specialNavLinkList">
                        </ul>
                    </ContentTemplate>
                </SharePoint:UIVersionedContent>
                </asp:ContentPlaceHolder>
                </div>
                </div>
                        </asp:ContentPlaceHolder>
                    </div>
                </div>
    
                </div>
        </td>
                </tr>
                <tr>
                    <td><img src="../../Style Library/Images/whtDiv.gif" /></td>
                </tr>
            </table>
        </asp:ContentPlaceholder>
    

    On the pagelayouts I don't want this on I have this:

    <asp:Content ContentPlaceHolderId="LeftNavTableCell" runat="server"></asp:Content>
    

    but the image still shows up.

  • If that's a viable solution for you, you could reference a javascript framework like jQuery and hide the left nav by default by overriding 'display' CSS property of the left nav container with 'none' and setting it back to 'block' using conditional javascript calls like the following

     if (/\/Pages\/ShouldShowLeftNav\.aspx/i.test(location.href)) $(selector).show();
    

Tags
Related questions and answers
  • ;xsl:param name="Pos" /&gt; &lt;tr>; &lt;td>; &lt;table border="0" cellspacing="0" width="100%"&gt;&lt;tr>;&lt;td class="ms-formlabel" valign="top" nowrap="true...;/td>; &lt;td width="75%" class="ms-formbody"&gt; &lt;SharePoint:FormField runat="server" id="ff2{$Pos}" ControlMode="Edit" FieldName="Comments1..." border="0" width="100%"&gt; &lt;tr>; &lt;td class="ms-vb"&gt; &lt;xsl:text disable-output-escaping="yes" ddwrt:nbsp-preserve="yes"&gt;&amp;nbsp;&lt

  • . &lt;TABLE>;&lt;TBODY> &lt;TR>; &lt;TD vAlign=top>&lt;BUTTON style="FONT-STYLE: normal; FONT-FAMILY: Segoe UI; FONT-SIZE: 9pt; FONT-WEIGHT: 400; TEXT-DECORATION: none" id..."&gt; &lt;SPAN style="VERTICAL-ALIGN: middle"&gt;Кому: &lt;/SPAN>&lt;/NOBR>&lt;/BUTTON>&lt;/TD>; &lt;TD style="WIDTH: 100%"&gt;&lt;SPAN onmouseover="return... (ContactPicker.OnEditBoxBlur(this, event));" style="BORDER-BOTTOM: 0px; BORDER-LEFT: 0px; WIDTH: 100%; BORDER-TOP: 0px; BORDER-RIGHT: 0px" id=V1_I1_CP2_EditBox onfocus="return

  • " cellspacing="0" cellpadding="0" class="bgTop"&gt; &lt;tr>; &lt;td align="center"&gt; &lt;table width="579" height="108" border="0" cellspacing="0" cellpadding="0...; &lt;/table>; &lt;/td>; &lt;/tr>; &lt;/table>; &lt;table width="579" border="0" cellspacing="0" cellpadding="0" class="bg"&gt; &lt;tr>; &lt;td width="100%" align="center" valign="top"&gt; &lt;table width="530" border="0" cellspacing="0" cellpadding="0"&gt; &lt;tr>; &lt;td

  • ','')} } }); }); &lt;/script>&lt;div id="dialog" title="Question" style="display:none"&gt;&lt;span>&lt;/span>&lt;span>What is the Capital of Massachusetts ?&lt;/span>&lt;table id="ctl00_m_g_583145bb_3463_40cc_b5ef_6f42c371f376_ctl02" border="0"&gt; &lt;tr>; &lt;td>;&lt;input id="ctl00_m_g_583145bb_3463_40cc_b5ef_6f42c371f376_ctl02_0...;script language="javascript"&gt; $(document).ready(function() { $("#dialog").dialog({ bgiframe: true, height: 300, modal: true, closeOnEscape: false, width: 400, buttons: { 'Skip': function

  • as the current user. &lt;xsl:if test="@MyField = $UserID"&gt; ... code here ... &lt;/xsl:if> But the compare fails because the content from the MyField is something like : &lt;span> &lt;A HREF="/sites/121579/MySite/_layouts/userdisp.aspx?ID=452"&gt;***, Stef</A> &lt;img border="0" height="1" width="3" src="/_layouts/images/blank.gif"/&gt; &lt;a href='javascript:' onclick='IMNImageOnClick();return false;' class='ms-imnlink'&gt; &lt;img name='imnmark' title='' border='0' height='12' width='12' src='/_layouts/images/blank.gif' alt

  • Possible Duplicate: How to use JavaScript and CSS in a web part? I am using SharePoint Server 2007 Enterprise with Windows Server 2008 Enterprise. I am developing using VSTS 2008 + C# + .Net 3.5 + ASP.Net. I have the following code which works correctly in ASP.Net (aspx) and I want to implement the same function in a WebPart and deploy into a page of SharePoint publishing portal site...; &lt;body> &lt;div class="demo"&gt; &lt;div id="tabs"&gt; &lt;ul> &lt;li>&lt;a href="#tabs-1"&gt;tab1&lt;/a>&lt;/li> &lt;li>&lt;a href="#tabs-2"&gt;tab2&lt

  • changed according to the max length of items on left navigration bar? &lt;SharePoint:AspMenu ID="CurrentNav" width="120" runat="server" datasourceID="SiteMapDS" orientation="Vertical" StaticDisplayLevels="2" MaximumDynamicDisplayLevels="0" StaticSubMenuIndent="1" ItemWrap="true" AccessKey="3" CssClass="leftNav" SkipLinkText="&lt;%$Resources:cms,masterpages_skiplinktext%&gt;"&gt; ...I am editing the following master page which my current SharePoint site is using (I am using SharePoint 2007 + Windows Server 2008), http://www.mediafire.com/file/mmvj5ijgm3j/BlueBand.master

  • ? &lt;link type="text/css" href="_layouts/test/themes/base/ui.all.css" rel="stylesheet" /&gt; &lt;script type="text/javascript" src="_layouts/test/jquery-1.3.2.js"&gt;&lt;/script> &lt;script type="text/javascript" src="_layouts/test/ui/ui.core.js"&gt;&lt;/script> &lt;script type="text/javascript" src="_layouts/test/ui/ui.tabs.js"&gt;&lt;/script> &lt;link type="text/css" href="_layouts...I am using SharePoint Server 2007 Enterprise with Windows Server 2008 Enterprise. And I am developing using VSTS 2008 + C# + .Net 3.5 + ASP.Net + JavaScript (jQuery). I met with the following

  • :DropDownList ID="ddlEnquiryType" runat="server" AutoPostBack="True" DataSourceID="ObjectDataSource2" DataTextField="meaning" DataValueField="meaning" Width="256px"&gt; The TypeName entry is referring... in the TypeName property of ObjectDataSource 'ObjectDataSource2' could not be found The relevant 'ObjectDataSource2' in the ascx file has this code: &lt;asp:ObjectDataSource ID="ObjectDataSource2" runat="server" InsertMethod="Insert" OldValuesParameterFormatString="original_{0}" SelectMethod="GetDataByEnquiryType" TypeName="crmDatasetTableAdapters.Lookup_tableTableAdapter"&gt; &lt;InsertParameters>

Data information