9/25/2009

SharePoint: Hiding the Search Box

Sometimes a site or site page has only one purpose, and you don’t want the distraction of the search controls. The search controls are easy to hide and can be hidden at various levels…

 

To hide the search control on just one page:

  • Add a Content Editor Web Part (CEWP)
  • Edit the web part and click the Source Editor button
  • Paste the following:
   <style>
     #SRSB {display:none}
   </style>

 

To hide the search control on all pages:

  • Use SharePoint Designer to edit your master page and put the above style tag just after the SharePoint style controls
   <SharePoint:CssLink runat="server"/>
<SharePoint:Theme runat="server"/>
<style> #SRSB {display:none} </style>

To let the site owners hide or show by using a feature:

The search box is actually an ASP.Net Web User Control (.ASCX) that can be replaced by using a SharePoint “feature”. If you want nothing displayed you can just create a one line .Net Web User Control (using Notepad if you like):
<%@ Control Language="VB" ClassName="yourclassname" %>
Here's an article with enough info to get you started on building the feature (just leave out the Google stuff):
http://techtrainingnotes.blogspot.com/2009/07/sharepoint-custom-search-boxes-google.html

.

No comments:

Note to spammers!

Spammers, don't waste your time... all posts are moderated. If your comment includes unrelated links, is advertising, or just pure spam, it will never be seen.