A colleague of mine was wanting to make some changes to the SmallSearchInputBox delegate control in SharePoint 2007. That’s the control that appears on most pages, looking like:
This control is a ‘Delegate control’ – that is, you can create features to override the currently used control. What my colleague wanted to do was not display the ‘Scope’ drop down list, the Advanced Search link, and to include prompt text (something like ‘Enter Search…’). A quick dig into the FEATURES folder in 12 Hive showed that the control had a number of properties.
(The features that this information applies to are the OSearchBasicFeature and OSearchEnhancedFeature. Both contain files called ‘SearchArea.xml’, and that contains the code below. I found the folders with this in:
%12 Hive%TemplateFeaturesOSearchEnhancedFeature )
<?xml version="1.0" encoding="utf-8" ?>
ControlClass="Microsoft.SharePoint.Portal.WebControls.SearchBoxEx" ControlAssembly="Microsoft.SharePoint.Portal, Version=18.104.22.168, Culture=neutral, PublicKeyToken=71e9bce111e9429c">
This shows a property
ShowAdvancedSearch which sounded pretty promising for turning off the Advanced Search link. We decided to see what other properties were available, and found a good article by Clint Cherry about the SmallSearchInputBox control, and the MSDN docs. The Property tags in the XML for the delegate control set the properties of the web control class – e.g. GoImageUrl matches the GoImageUrl property on the class. Much to our pleasure, we found the
QueryPromptString displays text in the search control which vanishes when it receives focus, and the
DropDownMode property allows us to turn off the scope dropdown list. Hurrah!
For the values that you can set the drop down mode to, see the MSDN docs again
7 thoughts on “Changing the SmallSearchInputBox delegate control”
Hi, This is a good article and better is the Clint Cherry’s one. But, I want to modify the search control in a WSS installation. The feature is different or I don’t know how to search it on FEATURES folder. Could you show me how it can be done on WSS???
Thanks in advance.
Just a note for dudes using WSS…
As far as i can see this does not work for WSS 3. The file I found in the 12-folder is called “Feature.xml” …. loacted in “…..12TEMPLATEFEATURESSPSearchFeature”.
In the folder “…..12TEMPLATECONTROLTEMPLATES” theres a file called “SearchArea.ascx”… but that’s a ASP.NET file (or whatever) not XML. I could edit this file, but that would be even more crappy then WSS itself. Or I could style the search-field using CSS, but the control has a lot of useless HTML that I would like to get rid of… Like “display=inline” – get real Microsoft thats CSS not HTML
From the SearchArea.ascx:
< INPUT Type=TEXT id=’idSearchString’ size=25 name=’SearchString’ display=’inline’ maxlength=255 ACCESSKEY=S class=’ms-searchbox’ …
Hmm, yes my article misses some information.
The features that this information applies to are the OSearchBasicFeature and OSearchEnhancedFeature. Both contain files called ‘SearchArea.xml’, and that contains the code above.
I don’t know if this is the same in WSS – but if you can’t find folders called:
% 12 Hive%TemplateFeaturesOSearchBasicFeature or
% 12 Hive%TemplateFeaturesOSearchEnhancedFeature
…then I’d suggest that this doesn’t apply. In fact, given that WSS and MOSS have quite different search functionality, I’d suggest that this is likely to be the case.
And yes, the CONTROLTEMPLATES directory contains ASPX controls. And yes, they’re not always the best written.
I dont know whether am running sharepoint 2007 or wss 3.0 . I think wss 3.0. How to find it.
This works well with me, just have to change property to false of false
as you described
Suresh kumar V.C
I confirm, this does not apply to WSS 3.0. These features described here are not part of the WSS 3.0 search.
Great article. I updated the xml files and saved them but the changes aren’t reflected on the page until I perform an iisreset. I assume it’s SP caching the control, you might want to mention an iisreset is required.
Yup, that’d be correct – sorry, I didn’t mention that ‘cos I’m sort of used to having to do an IIS reset after, well, just about everything in Sharepoint 2007!