惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

D
Docker
酷 壳 – CoolShell
酷 壳 – CoolShell
博客园 - Franky
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
A
About on SuperTechFans
博客园 - 【当耐特】
Microsoft Security Blog
Microsoft Security Blog
H
Hackread – Cybersecurity News, Data Breaches, AI and More
The GitHub Blog
The GitHub Blog
雷峰网
雷峰网
博客园_首页
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
IT之家
IT之家
博客园 - 叶小钗
Google DeepMind News
Google DeepMind News
aimingoo的专栏
aimingoo的专栏
博客园 - 聂微东
B
Blog RSS Feed
H
Help Net Security
Recent Announcements
Recent Announcements
阮一峰的网络日志
阮一峰的网络日志
D
DataBreaches.Net
L
LangChain Blog
Vercel News
Vercel News

博客园 - 皮皮@北京

最牛比的IE。。 微软于周一正式公布了下一个版本的SharePoint服务器版本的初步系统要求 讨厌的K2变化ProcessInstance.DataFields - 皮皮@北京 - 博客园 安装SQL Server 2008 及 VS 2008(转自邹建老大的blog) Windows SharePoint Services 3.0 通用参考中文版 Microsoft Office SharePoint Server 2007 通用参考中文版 避免Webpart Page的URL地址中带ID参数的问题 用js改变MOSS自带的一些按钮的默认事件 K2中的任务代理 [转]大学厕所里爆笑接龙(好久没更新了啊。。) 解决:K2.net Studio 遇到问题需要关闭 K2 BlackPearl中日志记录的设置与扩展 The Sharepoint 2007 Song WorkflowManagementHostServer Not Hosted! 用ddwrt:URLLookup在列表自定义页面中显示查阅项的链接 SharePoint Permissions Matrix 记录中心设置 如何给SPListItem中DateTime类型的Field赋空值 巨爆笑~
自定义MOSS搜索框
皮皮@北京 · 2009-06-13 · via 博客园 - 皮皮@北京

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

开始有这个需求的时候,我是用修改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对应的属性是一样的

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