Custom Moss search box

Source: Internet
Author: User

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.