如何修改自定义Webpart的标题?(downmoon)

本文介绍了在SharePoint中修改自定义WebPart标题的方法,包括通过事件处理、工具栏定制及初始化方法等,并分享了使用HyperLink作为WebPart标题的技巧。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

 

如何修改自定义Webpart的标题?
在事件里很好写
比如

 

 

None.gifprivate void BtnText_Click(object sender, EventArgs e)
ExpandedBlockStart.gifContractedBlock.gif  
...{
InBlock.gif   
this.Title = this.txtTitle.Text;
ExpandedBlockEnd.gif  }

None.gif

另外网上比较浒的一个方法是:

 

None.gifpublic override ToolPart[] GetToolParts()
ExpandedBlockStart.gifContractedBlock.gif  
...{
InBlock.gif   ToolPart[] toolparts 
= new ToolPart[2];
InBlock.gif   WebPartToolPart wptp 
= new WebPartToolPart();
InBlock.gif   CustomPropertyToolPart custom 
= new CustomPropertyToolPart();
InBlock.gif   toolparts[
0= wptp;
InBlock.gif
InBlock.gif   
//hide the default title property
InBlock.gif   
//wptp.Hide(Microsoft.SharePoint.WebPartPages.WebPartToolPart.Properties.Title);
InBlock.gif
   toolparts[1= custom;
InBlock.gif   
return toolparts;
ExpandedBlockEnd.gif  }


可是大多数时候由于页面中不上一个Webpart,,有时也会互相打架,导致无效!
其实下面的方法才是正解
protected override void OnInit(EventArgs e)
{
    base.OnInit (e);
    this.Title = "Set title here...";
}
新问题是:如何将一个HyperLink做WebPart的标题?
后来经过仔细研究,原来
WebPart有个属性可以赋值:
this.DetailLink=this.lblMoreUrl.Text;
OK!· 爽!

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值