Home > SharePoint > How to create a Search Box delegate in SharePoint

How to create a Search Box delegate in SharePoint

Search-48x48Simple but effective…I recently had to change the behaviour of the ‘SmallSearchBox’ control within  SharePoint. I wanted to loose the ‘Advanced Search;’ link, the button style and also add some default text into the search box. I found the following method to be the simplest approach.

Standard Search Box



Custom delegate applied


The search box is rendered using a delegate control. If you look at the master page you will see the delegate …

<SharePoint:DelegateControl runat=”server” ControlId=” SmallSearchBox”>

You can alter the behaviour of a delegate control by specifying a delegate with a smaller sequence number. I created the following delegate control within a standard feature…


<?xml version="1.0" encoding="utf-8"?>
Elements xmlns="http://schemas.microsoft.com/sharepoint/">


Control Id="SmallSearchInputBox" Sequence="10"

ControlClass="Microsoft.SharePoint.Portal.WebControls.SearchBoxEx" ControlAssembly="Microsoft.SharePoint.Portal, Version=, Culture=neutral, PublicKeyToken=71e9bce111e9429c">
Property Name="GoImageUrl">/_layouts/images/CFB/go.gif</Property>
Property Name="GoImageUrlRTL">/_layouts/images/CFB/.gif</Property>
Property Name="GoImageActiveUrl">/_layouts/images/CFB/go.gif</Property>
Property Name="GoImageActiveUrlRTL">/_layouts/images/CFB/go.gif</Property>
Property Name="UseSiteDefaults">true</Property>
Property Name="FrameType">None</Property>

<Property Name="ShowAdvancedSearch">false</Property>
Property Name="QueryPromptString">Search…</Property>
Property Name="DropDownMode">HideDD_useDefaultScope</Property>



Note the Sequence=”10” attribute of the Control element. WSS out of the box refers to a sequence number of 100 and MOSS overrides this with a sequence number of 50. So as long as your sequence number is lower than this then your settings will be applied.

The four changes I was concerned was

1. Remove the ‘advanced search’ link which is handled by  the ‘ShowAdvancedSearch’ property,

2.Add some default text to the search box which is handcled by  the QueryPromptString property

3. Remove the scope drop down field. The DropDownMode property with the enumuration value of HideDD_userDefaultScope sorts that one out.

4. Finally I changed the image to my own go.gif image. I also deployed this within the same feature to a sub directory called CFB within the 12 hive images folder.

For a complete listing of the available properties please refer to the following link on MSDN.



About these ads
Categories: SharePoint Tags: , ,
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


Get every new post delivered to your Inbox.

%d bloggers like this: