Monday 11 February 2013

Hide First Tab in SharePoint 2010 Navigation

I have two tabs let say Tab1 and Tab2. After activting "SharePoint Server Publishing Infrastructure" feature, I found that Tab link is showing one more tab named as Site name (Home, Tab1,Tab2).
I was trying to remove Home tab but not able to do the same.
After googling I found different solutions:
  1. This link is saying that, we need to do some modifications in master page as follows:
  •  Add <%@ Register Tagprefix="PublishingNavigation" Namespace="Microsoft.SharePoint.Publishing.Navigation" Assembly="Microsoft.SharePoint.Publishing, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
  • Use
<PublishingNavigation:PortalSiteMapDataSource
     ID="topSiteMap"
       Runat="server"
         SiteMapProvider="CombinedNavSiteMapProvider"
           StartFromCurrentNode="true"
             StartingNodeOffset="0"
               ShowStartingNode="false"
                 TrimNonCurrentTypes="Heading" />
                  in place of 
                    <SharePoint:DelegateControl runat="server" ControlId="TopNavigationDataSource" Id="topNavigationDelegate">
                      <Template_Controls>
                        <asp:SiteMapDataSource
                           ShowStartingNode="False"
                             SiteMapProvider="SPNavigationProvider"
                               id="topSiteMap"
                                 runat="server"
                                   />
                                    </Template_Controls>
                                      </SharePoint:DelegateControl>

                                      It works. It will hid  Home tab. But issue is that when I clicked my Tab2, I found that focus is still on tab1. Means focus is not moving now from one tab to another on selection.

                                      I then reset my master page.

                                      Then I found this link. This link is showing to use css only.
                                      So in head section of master page I add following
                                      <style type="text/css">
                                      .s4-tn li.static > a{ 
                                      display: none !important; 
                                      .s4-tn li.static > ul a{ 
                                      display: block !important; 
                                      }
                                      </style>

                                      And wow. It worked.

                                      No comments :

                                      Post a Comment