다음을 통해 공유


How to: Add the Search Tab Navigation Control to a Page

Applies to: SharePoint Server 2010

Search pages in Microsoft SharePoint Server 2010 for Search or in Microsoft SharePoint Server 2010 search sites created by using the Basic Search Center template do not contain the tab navigation control. However, you can use the tab navigation control in these pages. To do so, you add the control to the page. For tabs to appear in the control, they must exist in the search tabs lists. This topic describes how to add the tab navigation control code by using Microsoft SharePoint Designer 2010, and then add a tab so that it is displayed in the control.

To add the tab navigation control by using SharePoint Designer

  1. Open your site in the browser.

  2. On the Site Actions menu, click Edit in SharePoint Designer.

  3. In the left navigation pane, click All Files.

  4. In the main window, click the page that you want to add the tab navigation control to.

  5. To view the code, you must change from Design view, so click Split or Code in the view tabs section at the bottom of the main window.

  6. Add the code for the tab navigation control to the page.

    If you are adding the control to a search results page, such as results.aspx, use the following code.

    <SPSWC:ListBoundTabStrip runat="server" id="Tab" persistQueryString="true" 
    cssClassNamePrefix="ms-sctab" ListName="<%$Resources:Microsoft.Office.Server.Search,SearchCenterOnet_SearchResultsListName%>" 
    ResourceIdforListName="$Resources:Microsoft.Office.Server.Search,SearchCenterOnet_SearchResultsListName" UnselectedTabTrimLength="-1" 
    IgnoredQueryStringParameters="s,s1,s2,s3,s4,s5,start,start1,start2,start3,start4,start5,v,v1,v2,v3,v4,v5,hs,hs1,hs2,hs3,hs4,hs5,rm,rm1,rm2,rm3,rm4,rm5,r">
    </SPSWC:ListBoundTabStrip>
    

    If you are adding the control to a page that is not a search results page, such as default.aspx, use the following code.

    <SPSWC:ListBoundTabStrip ID="Tab" runat="server" PersistQueryString="true" CSSClassNamePrefix="ms-sctab" 
    ListName="<%$Resources:Microsoft.Office.Server.Search,SearchCenterOnet_SearchCenterListName%>" 
    ResourceIdforListName="$Resources:Microsoft.Office.Server.Search,SearchCenterOnet_SearchCenterListName" UnselectedTabTrimLength="-1">
    </SPSWC:ListBoundTabStrip>
    

    If you want the tab navigation control to appear in the same location that it does on sites created by using the Enterprise Search Center template, add the markup control within the PlaceHolderTitleBreadcrumb content placeholder, as follows.

    <asp:Content ContentPlaceHolderID="PlaceHolderTitleBreadcrumb"  runat="server">
        <A name="mainContent"></A>
        <div style="height:100%; width:100%;padding-left: 2px; padding-top: 16px; padding-bottom: 14px;">
            <div style="WIDTH: 390px" >
               <SPSWC:ListBoundTabStrip ID="Tab" runat="server" PersistQueryString="true" CSSClassNamePrefix="ms-sctab" 
    ListName="<%$Resources:Microsoft.Office.Server.Search,SearchCenterOnet_SearchCenterListName%>" 
    ResourceIdforListName="$Resources:Microsoft.Office.Server.Search,SearchCenterOnet_SearchCenterListName" UnselectedTabTrimLength="-1">
               </SPSWC:ListBoundTabStrip>   
            </div>
            <WebPartPages:WebPartZone runat="server" AllowPersonalization="false" FrameType="TitleBarOnly" 
    title="<%$Resources:sps,LayoutPageZone_TopZone%>" id="TopZone" orientation="Vertical" 
    QuickAdd-GroupNames="Search" QuickAdd-ShowListsAndLibraries="false"/> 
        </div>
    </asp:Content>
    
  7. Save your changes to the ASPX page.

  8. Repeat steps 4 through 7 for the other site pages that you want to add the tab navigation control to.

For tabs to appear in the tab navigation control, they must exist in the following two search tabs lists:

  • Tabs in Search Pages

  • Tabs in Search Results

The following procedures describe how to verify that the tabs exist in the lists, and how to add them if they are missing.

To verify the tabs in the Tabs in Search Pages list

  1. Open your site in the browser.

  2. On the Site Actions menu, click View All Site Content.

  3. In the Lists section, click Tabs in Search Pages.

    This list includes all the tabs that are displayed in the tab navigation control instance on pages that are not search results pages. If you do not see the tab that you want displayed in the tab navigation control here, you must add it to a page that contains the control, such as default.aspx.

    To add the tab to Tabs in Search Pages

    1. Navigate to a page that is not a search results page, such as default.aspx.

    2. On the Site Actions menu, click Edit Page.

    3. In the tab navigation control, click Add New Tab.

    4. Type a name in the Tab Name field, for example, Custom Results.

    5. Type the page name in Page field, for example, customresults.aspx, and then click Save.

You should now see your tab in the Tabs in Search Pages list. It should also appear on any page that is not a search results page that contains the tab navigation control. Next, you must add the tab to the Tabs in Search Results list.

To verify the tabs in the Tabs in Search Results list

  1. Open your site in the browser.

  2. On the Site Actions menu, click View All Site Content.

  3. In the Lists section, click Tabs in Search Results.

    This list includes all the tabs displayed in the tab navigation control instance on search results pages. If you do not see the tab that you want displayed in the tab navigation control here, you must add it to a search results page that contains the control, such as results.aspx.

    To add the tab to Tabs in Search Results

    1. Navigate to results.aspx.

    2. In the Site Actions menu, click Edit Page.

    3. In the tab navigation control, click Add New Tab.

    4. Type a name in the Tab Name field, for example, Custom Results.

    5. Type the page name in Page field, for example, customresults.aspx, and then click Save.

You should now see your tab in the Tabs in Search Results list. It should also appear on any search results page that contains the tab navigation control.