Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

How to: Add the Scopes Notification Control to a Custom Results Page

SharePoint 2010

Last modified: April 20, 2010

Applies to: SharePoint Server 2010

The Site Search results page, osssearchresults.aspx, contains the scopes notification control. This control notifies the user of the available custom scopes, which enables the user to search through a broader range of sites. This control is not available in the Web Part gallery, so when you want to display the scopes notification control on a search results page, you must add the code for this control to the page.

This topic describes how to add the code to a search results page to display the scopes notification control.

To add the scopes notification control

  1. Open the search results file in an HTML editor such as Microsoft SharePoint Designer 2010, or in a text editor such as Notepad.

  2. Add the tag prefix registration for the scopes notification control by using the following code.

    <%@ Register Tagprefix="MSWSC" Namespace="Microsoft.SharePoint.Portal.WebControls" 
    Assembly="Microsoft.Office.Server.Search, Version=14.0.0.0, Culture=neutral, 
    PublicKeyToken=71e9bce111e9429c" %>
    
  3. Add control to the page using the following code

    <MSWSC:searchnotification  runat="server"/>
    
  4. Enable custom scopes for the site collection.

    To enable custom scopes for the site collection

    1. Open the site collection’s Site Settings page by appending /_layouts/settings.aspx to the site collection's URL, as follows:

      http://SiteCollectionURL/_layouts/settings.aspx

    2. In the Site Collection Administration section of the Site Settings page, click Search settings.

    3. In the Site Collection Search Center section, select Enable custom scopes, specify the Search Center to connect the site collection to, and then click OK.

  5. To test the scopes notification control code, create a basic test page by using the code in the Example section of this topic. Then, navigate to the test page in the browser, and append a search query to the URL by using the k parameter in the query string, as follows:

    http://SiteURL/pages/ScopesNotificationTest.aspx?k=queryTerm

You can use the following code to create a basic page to test the scopes notification control.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<%@ Page Language="C#" %>
<html dir="ltr" xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta name="WebPartPageExpansion" content="full" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled 1</title>
</head>
<body>
The scopes notification control should appear below this text:
<%@ Register Tagprefix="MSWSC" Namespace="Microsoft.SharePoint.Portal.WebControls" Assembly="Microsoft.Office.Server.Search, 
Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %><MSWSC:searchnotification  runat="server"/>
<form id="form1" runat="server">
</form>
</body>
</html>
Show:
© 2015 Microsoft