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

推荐订阅源

GbyAI
GbyAI
Y
Y Combinator Blog
Recent Announcements
Recent Announcements
D
Docker
Blog — PlanetScale
Blog — PlanetScale
罗磊的独立博客
美团技术团队
V
V2EX
Last Week in AI
Last Week in AI
D
DataBreaches.Net
T
The Blog of Author Tim Ferriss
宝玉的分享
宝玉的分享
Microsoft Security Blog
Microsoft Security Blog
Microsoft Azure Blog
Microsoft Azure Blog
人人都是产品经理
人人都是产品经理
M
MIT News - Artificial intelligence
P
Proofpoint News Feed
B
Blog RSS Feed
博客园_首页
B
Blog
博客园 - 叶小钗
I
InfoQ
WordPress大学
WordPress大学
L
LangChain Blog
Apple Machine Learning Research
Apple Machine Learning Research
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
A
About on SuperTechFans
The GitHub Blog
The GitHub Blog
The Register - Security
The Register - Security
MyScale Blog
MyScale Blog
云风的 BLOG
云风的 BLOG
博客园 - 司徒正美
Latest news
Latest news
W
WeLiveSecurity
T
The Exploit Database - CXSecurity.com
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
aimingoo的专栏
aimingoo的专栏
小众软件
小众软件
Cyberwarzone
Cyberwarzone
Scott Helme
Scott Helme
D
Darknet – Hacking Tools, Hacker News & Cyber Security
C
CERT Recently Published Vulnerability Notes
C
CXSECURITY Database RSS Feed - CXSecurity.com
Recent Commits to openclaw:main
Recent Commits to openclaw:main
N
News and Events Feed by Topic
S
Secure Thoughts
The Hacker News
The Hacker News
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Google DeepMind News
Google DeepMind 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对应的属性是一样的

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