Article Categories
Archives
Post Categories
  Jump to Information for:
Search:  

A common request is to alter the default look of the search input and button area to something that better matches a design or fits better in space that is available.  When working with the default search, you are limited to the CSS classes provided to you and the layout that ships with SharePoint.  It is possible to create your own search display by deploying a Feature.  Note I am not referring to search results, just the search box area available on most SharePoint pages, generally located in the header section.

MSDN documents this process and the code they provide will nearly work as is.   There are two changes that need to be done to their code in order for the Feature to function on your web site. Below are the changes and a few other tips and resources to help you.

*** NOTE:  This is to modify the basic search for WSS.  MOSS uses another Feature for search (OsearchEnhancedFeature) and if you do the following actions, your custom scopes will not appear in the drop down box. If you are not using custom scopes, or if you don't want or use "All Sites" and "People" search scopes, you can use this method to adjust your MOSS search display. ***

  1. Open up the MSDN article.
  2. Complete step 1 and 2.
    1. Note the HIDDEN property and value in the Feature tag.  Make sure you change the HIDDEN value to FALSE.  We need to show the Feature.  :-) Thanks to AC for this tip. This is not required, but you will more than likely want to show this Feature in your site Features list.
    2. Note the SCOPE property and value. This article has you set the Feature's scope to WEB, which is fine.  But you will have to activate this Feature for every site (and sub site) that needs to use the new search area. Depending on your setup, this may not be ideal.  Other options for this value are Farm, WebApplication, and Site. The first two are self explanatory, and Site means site collection.  Web means a single web site.
  3. Complete step 3.
    1. Note the sequence value.  For WSS, 99 will work.  For MOSS, you need to lower the value to 20. Thanks to AC's book, Professional SharePoint 2007 Web Content Management Development: Building Publishing Sites with Office SharePoint Server 2007 (Wrox Programmer to Programmer) for this tip.
    2. Note the two properties the article has you add in.  For a full list of possible properties you can use here, check out the SearchBoxEx Members and look under Public Properties.
  4. Complete step 4.  Note that you can name the new file whatever you like, and store it in a sub folder.  If you place the file in  sub folder, you can easily identify your custom ASCX files and they won't get lost in the jumble of the default SharePoint files.
  5. Step 5 is up to you.  If you want to do the changes just like the article, follow this step. Otherwise, in your custom ASCX file, make any adjustments you like including dropping the table, using DIVs, adding custom text and images, etc.  You can also specify custom CSS classes.  Store your CSS properties in your site style sheet.
  6. Complete steps 6 and 7.  Note, if you set the scope to Farm, you don't have to activate the Feature. That happens automatically when you install the Feature.

That's it!  In a relatively short period of time you can create a custom search display for your site.

Alternatively, John Ross has blogged about another method using JavaScript. Check out his post here.

I have found a few more resources online, here they are in case you want to learn/do more:
Project to customize the small search control in SharePoint 2007
Redirect Contextual Search Results to Search Centre Results Page
Search Results Page may be different per Search Scope

posted on Thursday, August 21, 2008 12:03 PM
Comments
  •  re: SharePoint 2007 Design Tip: Create a custom search input interface
    Marja
    Posted @ 8/22/2008 5:52 AM
    Dear Heather,

    Very nice solution.
    The only weird thing that happens is that the searchscopes change to "this Site" and "This List".
    In the site settings the scopes still show the options "All sites" and "People"".

    searching gives no results, but the error :
    "Your search cannot be completed because this site is not assigned to an indexer"
  •  re: SharePoint 2007 Design Tip: Create a custom search input interface
    Ted
    Posted @ 8/22/2008 10:35 AM
    Thanks Heather! Just figured this one out as well. Turns out the sequence 99 works *unless* you've installed MOSS as well as WSS, in which case there are already 2 delegate controls you have to get "under" in sequence. I think 25 is the number I ran into.

    Great info thanks!
  • # re: SharePoint 2007 Design Tip: Create a custom search input interface
    Heather
    Posted @ 8/22/2008 5:12 PM
    Marja- I updated my post to clarify that is is best suited for WSS sites. Check out the added URLs at the end for more info about your issue. I did not run into any issues executing a search after doing this, I would suggest you look into alternative causes for your search error.
  • # re: SharePoint 2007 Design Tip: Create a custom search input interface
    Heather
    Posted @ 8/22/2008 5:12 PM
    Ted- Thanks for the tip, I updated the blog post!
  •  re: SharePoint 2007 Design Tip: Create a custom search input interface
    Ted
    Posted @ 8/25/2008 1:21 PM
    Found the other delegate control sequence numbers:

    ContentLightUp: Sequence = 100
    OsearchBasicFeature: Sequence = 75
    OsearchEnhancedFeature: Sequence = 25
  •  re: SharePoint 2007 Design Tip: Create a custom search input interface
    self-made
    Posted @ 9/24/2008 5:19 PM
    To Marja's post. I am having the same issue. I have found NOTHING on the web to solve this delima. I need my Scope to show up and I only get This Site, This List. It must be something simple since no one has posted any suggestions about how to fix this issue.

  •  re: SharePoint 2007 Design Tip: Create a custom search input interface
    Mark
    Posted @ 11/19/2008 6:40 AM
    Thanks for this post Heather. A question I have though:

    Step 3 b you say "Note the two properties the article has you add in. For a full list of possible properties you can use here, check out the SearchBoxEx Members and look under Public Properties. "

    We are no longer using a SearchBoxEx control though, we are using a SearchArea control, and the public properties are very different. Check them out at http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.webcontrols.searcharea_members.aspx

    Please correct me if I'm wrong, but the majority of the SearchBoxEx properties will obviously not work (unless there are properties also used by SearchArea).
Title  
Name  
Email (never displayed)
Url
Comments   
ALL COMMENTS ARE MODERATED! Sorry for the inconvenience, but it is how I keep all of the spam and advertisers out. I moderate comments about once a week and your comment will appear soon. Thanks for posting!
Please add 3 and 3 and type the answer here:

Copyright © 2005-2008. Heather Solomon.
Site design by Heather Solomon

Blog Stats:
Posts - 378
Stories - 38
Comments - 1581
Trackbacks - 182