by Martin
12. marts 2010 14:09
I've been working on a solution for a client, where I where to add a searchbox to the masterpage. This wasn't hard: just add a SearchBoxEx web control to the page, give it the runat="server", add the ScopeDisplayGroupName="[Name-of-scope-goes-here]" and go! This seemed somehow to do the job. Search results seem to be presented... But even though I had set the Search Center setting in the Site Settings to /Search/Pages, the results where always displayed on the /_layouts/OSSSearchResults.aspx page. Some of the scopes had a cusotm results page, but SharePoint didn't seem to honor this setting.
Enter the UseSiteDefaults-property of the SearchBoxEx control: this is per default set to false :( This has to be set to true, if you want to use the custom settings in the site and scopes! Resulting markup for SearchBoxEx:
<SPSWC:SearchBoxEx runat="server" TextBeforeDropDown="" ScopeDisplayGroupName="DisplayGroupName" UseSiteDefaults="true" />
This caused the searchbox to use the correct search settings (e.g.: peopleresults.aspx and results.aspx in the search center)
Easy as pie in the end, but hard to find out 