When customizing the parent page, sometimes you need to have some requirements for the search box in the upper-right corner of the page. For example, the drop-down box is too long and I want to make it smaller in width.
At the beginning, I implemented this by modifying CSS, but it was quite troublesome to modify CSS. Later I found that delegatecontrol can be used to implement it well.
Specific implementation:
Create a feature to implement delegatecontrol.
Feature. xml
1 <? XML version = "1.0" encoding = "UTF-8" ?>
2 < Feature Title = "XXX" Description = "XXX controls" ID = "B52ABDB5-601E-4847-A8BA-6D3AF5067B5F" Scope = "Farm" Hidden = "True" Alwaysforceinstall = "True" Xmlns = "Http://schemas.microsoft.com/sharepoint" >
3 < Elementmanifests >
4 < Elementmanifest Location = "Controls. xml" />
5 </ Elementmanifests >
6 </ Feature >
Controls. xml
1 <? XML version = "1.0" encoding = "UTF-8" ?>
2 < Elements Xmlns = "Http://schemas.microsoft.com/sharepoint" >
3 < Control ID = "Mysearchinputbox" Sequence = "50" Controlclass = "Microsoft. Sharepoint. Portal. webcontrols. searchboxex" Controlassembly = "Microsoft. Sharepoint. Portal, version = 12.0.0.0, culture = neutral, publickeytoken = 71e9bce111e9429c" >
4 < Property Name = "Goimageurl" > /_ Layouts/images/gosearch.gif </ Property >
5 < Property Name = "Goimageurlrtl" > /_ Layouts/images/gortl.gif </ Property >
6 < Property Name = "Goimageactiveurl" > /_ Layouts/images/gosearch.gif </ Property >
7 < Property Name = "Goimageactiveurlrtl" > /_ Layouts/images/gortl.gif </ Property >
8 < Property Name = "Dropdownmode" > Showdd </ Property >
9 < Property Name = "Dropdownwidth" > 100 </ Property >
10 < Property Name = "Textboxwidth" > 100 </ Property >
11 < Property Name = "Searchresultpageurl" > /Pages/searchresult. aspx </ Property >
12 < Property Name = "Scopedisplaygroupname" > Search drop-down list </ Property >
13 < Property Name = "Frametype" > None </ Property >
14 < Property Name = "Showadvancedsearch" > True </ Property >
15 </ Control >
16 </ Elements >
Masterpage
< SharePoint: delegatecontrol Controlid = "Mysearchinputbox" Runat = "Server" /> ,
As you can see, the drop-down box control has many attributes to implement the corresponding functions. These attributes correspond to the same attributes of the Web Part in the search box.
In this way, you can customize the search box on the motherboard page.