Friday, April 20, 2012

Changing SmallSearchInputBox delegate Control

SmallSearchInputBox is the search control which can be seen on most of SharePoint pages which gives the search option. It gives search scope drop down and will direct user to the search result page or advanced search page.  


The appearance of the search box control (SmallSearchInputBox control) can be change by overriding using a feature as given bellow:
·         In visual studio, add an “Empty Element” to the SharePoint project

 

·         Add following code to the “Elements.xml” file:


<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
  <Control Id="SmallSearchInputBox"
       Sequence="25"
       ControlAssembly="Microsoft.SharePoint.Portal, Version=12.0.0.0, Culture=neutral,    PublicKeyToken=71e9bce111e9429c"
       ControlClass="Microsoft.SharePoint.Portal.WebControls.SearchBoxEx">
    <Property Name="DropDownMode">ShowDD</Property>
    <Property Name="SearchResultPageURL">/Search/Pages/SearchResults.aspx</Property>
    <Property Name="FrameType">None</Property>
    <Property Name="DropDownWidth">140</Property>
    <Property Name="TextBoxWidth">140</Property>
    <Property Name="ShowAdvancedSearch">true</Property>
    <Property Name="TextBeforeDropDown">Search</Property>
    <Property Name="AdvancedSearchPageURL">/Search/Pages/AdvancedSearchResults.aspx</Property>
    <Property Name="QueryPromptString">Search...</Property>
  </Control>
</Elements>


·         Build and deploy the solution.

No comments:

Post a Comment