Sunday, 22 January 2012

Removing the default site name from top menu

By Default we will have the navigation code as below :

<asp:ContentPlaceHolder id="PlaceHolderTopNavBar" runat="server">
        <asp:ContentPlaceHolder id="PlaceHolderHorizontalNav" runat="server">
            <SharePoint:AspMenu
   ID="TopNavigationMenuV4"
   Runat="server"
   EnableViewState="false"
   DataSourceID="topSiteMap"
   AccessKey="<%$Resources:wss,navigation_accesskey%>"
   UseSimpleRendering="true"
   UseSeparateCss="false"
   Orientation="Horizontal"
   StaticDisplayLevels="2"
   MaximumDynamicDisplayLevels="1"
   SkipLinkText=""
   CssClass="s4-tn"/>

<SharePoint:DelegateControl runat="server" ControlId="TopNavigationDataSource" Id="topNavigationDelegate">
  <Template_Controls>
   <asp:SiteMapDataSource
     ShowStartingNode="False"
     SiteMapProvider="SPNavigationProvider"
     id="topSiteMap"
     runat="server"
     StartingNodeUrl="sid:1002"/>
  </Template_Controls>
 </SharePoint:DelegateControl>
  </asp:ContentPlaceHolder>
      </asp:ContentPlaceHolder>


To Remove the default site name Delete the <SharePoint:DelegateControl runat="server" ontrolId="TopNavigationDataSource" Id="topNavigationDelegate">
  <Template_Controls> and StartingNodeUrl="sid:1002"/>
so the code looks like this,

   <asp:SiteMapDataSource
     ShowStartingNode="False"
     SiteMapProvider="GlobalNavSiteMapProvider"
     id="topSiteMap"
     runat="server"
      StartFromCurrentNode="true" StartingNodeOffset="0"/>

           
    
      

No comments:

Post a Comment