In this previous post, I detailed how to ‘customise’ the OOTB SharePoint Search Box control – by including delegate properties. This works for MOST scenarios – but sometimes, you need more control (no pun intended).
For other scenarios – or if you can’t get it working/sand-boxed/etc – you can simply REPLACE the Delegate – with the actual SearchBoxEx control – within the Master Page.
To do this – you need to do the following :
- Open the Master Page (eg. v4.master) – in SharePoint Designer – or Visual Studio
- Add the following to the top of the page – to allow you to reference the Search Control :
<%@ Register Tagprefix="SharePointWebControls" Namespace="Microsoft.SharePoint.Portal.WebControls" Assembly="Microsoft.Office.Server.Search, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
Then, you can replace the delegate control :
- Do a search (CTRL-F) for “SmallSearchInputBox”
- Replace the following :
<SharePoint:DelegateControl ID="DelegateControl3" runat="server" ControlId="SmallSearchInputBox" Version="4"/>
- With this markup :
<SharePointWebControls:SearchBoxEx ID="SmallSearchBox" runat="server" ShowAdvancedSearch="false" QueryPromptString="Enter Search Term…" DropDownMode="HideDD_NoScope" SearchResultPageURL="/_layouts/osssearchresults.aspx" ScopeDisplayGroupName="" FrameType="None" DisplaySubmittedSearch="false" />
Once you have this in place, you can change any specific property for “SearchBoxEx” :
- Eg. QueryPromptString = Enter Search Term
See MSDN for a list of properties you can change/update – for the SearchBoxEx control.
Lastly – make sure you save/check-in the updated Master Page.
It should look identical – but you can now change the properties within the Master Page itself.
Good luck – this approach certainly worked for me !
![]()
September 9, 2011 at 7:00 am
We stumble over a strange behaviour of our custom master page when using this approach. The SearchBox worked well, but when we tried to delete a field from any list while the master page is active, we got an “Invalid ViewState” exception.
This behaviour is also described in http://social.technet.microsoft.com/Forums/en-NZ/sharepoint2010customization/thread/021c6c2d-4bdb-4e76-a48a-a51502fc809a .
In our case the SearchBoxEx control caused the exception, because after removing it from the master page we were able to delete fields again.
Pingback: Replace Delegate Control – SmallSearchInputBox « Pornjed's Blog
Pingback: SharePoint 2007 Missing Assembly Reference
May 8, 2013 at 12:38 pm
But the problem is that the Advance search URL is absolute and i have more than 20 web app which have there own search center….Please let me know the solution in case of changing advance serch link…
Thanks in advance…