Delegate control for Sharepoint Search

Delegate controls are a very good mechanism to replace an existing control with another control through a SharePoint Feature. For example a delegate control is declared as

<SharePoint:DelegateControl runat="server" ControlId="SmallSearchInputBox"/>

The key to have your custom search control appear in place of the above declaration is to ensure the following:

a) Create a feature with feature details file entries as below.

<?xml version="1.0" encoding="utf-8" ?> <Elements xmlns="https://schemas.microsoft.com/sharepoint/"> <Control Id="SmallSearchInputBox" Sequence="100" Url="~/_controltemplates/mysearchcontrol.ascx"/> </Elements>.

The sequence number and ID is very important. Your sequence number should be the lowest if there are already multiple features registered for the same control Id of "SmallSearchInputBox" .

b) if you have MOSS installed you will notice that there are already 3 features for SmallSearchInputBox (a quick search on Features folder will reveal this ) and the lowest sequence number is 25. So to have your control appear in place of the standard search box , reduce your sequence number to less than 25.

c) InstallĀ  and Activate the feature.

d) Restart IIS if necessary.