Tuesday, November 8, 2011

Hide First Tab in SharePoint 2010 Navigation

 In SharePoint 2010 when you create new site or sub-sites it will show Home in first tab. this post will show how to hide first tab.


Here is the original code of top navigation control:
<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>


And then make the following changes to the static, dynamic and site map provider:
<SharePoint:AspMenu    
  ID="TopNavigationMenuV4"    
  Runat="server"    
  EnableViewState="false"    
  DataSourceID="topSiteMap"    
  AccessKey="<%$Resources:wss,navigation_accesskey%>"    
  UseSimpleRendering="true"    
  UseSeparateCss="false"    
  Orientation="Horizontal"    
  StaticDisplayLevels="1"    
  MaximumDynamicDisplayLevels="2"    
  SkipLinkText=""    
  CssClass="s4-tn"/>    
        <asp:SiteMapDataSource    
          ShowStartingNode="False"    
          SiteMapProvider="CombinedNavSiteMapProvider"    
          id="topSiteMap"    
          runat="server"/>

No comments:

Post a Comment