• 自定义MOSS搜索框


    自定义母板页的时候,免不了有时候会需要对网页右上角那个搜索框有点需求,比如那个下拉框太长我想让它宽度变小点

    开始有这个需求的时候,我是用修改CSS来实现的,不过修改CSS是件挺麻烦的事,后来发现了使用DelegateControl可以很好的实现。

    具体实现:

    创建Feature,实现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">搜索下拉列表</Property>
    13     <Property Name="FrameType">None</Property>
    14     <Property Name="ShowAdvancedSearch">true</Property>
    15   </Control>
    16 </Elements>

    MasterPage

    <SharePoint:DelegateControl ControlId="MySearchInputBox" runat="server" />

    可以看出来,下拉框控件有很多的属性实现相应的功能,这些属性与搜索框webpart对应的属性是一样的

    这样就可以很好的定制母板页中的搜索框了。


  • 相关阅读:
    James 3.1服务器的安装与搭建
    Mybaits整合Spring
    动态sql
    Mybatis核心配置文件SqlMapConfig.xml
    Mapper动态代理方式
    WPF DatePicker
    UITableView(修改单元格)
    UITableView
    UIImageView
    UILabel
  • 原文地址:https://www.cnblogs.com/ycc/p/1502746.html
Copyright © 2020-2023  润新知