sharepoint中自定义webpart属性面板(Web Part Properties(ToolPart))
2009-05-13 13:49
483 查看
在sharepoint中webpart是少不了的,要是定制自己的webpart,webpart属性也少不了,但是微软提供给我们的方式有限,见:
http://msdn.microsoft.com/en-us/library/dd584174.aspx
但是这个方式还是比较好的http://msdn.microsoft.com/en-us/library/dd584178(office.11).aspx
这也有一篇http://www.zimmergren.net/archive/2008/11/29/how-to-custom-web-part-properties-toolpart.aspx
webpart代码
Code
using System;
using System.Collections.Generic;
using System.Text;
using System.Web.UI;
using System.Web.UI.WebControls;
using Microsoft.SharePoint;
namespace Zimmergren.CustomToolPart
{
public class CustomToolPart : Microsoft.SharePoint.WebPartPages.ToolPart
{
DropDownList ddl;
Panel toolPartPanel;
TextBox tb;
protected override void CreateChildControls()
{
toolPartPanel = new Panel();
ddl = new DropDownList();
ddl.ID = "ddl";
// Simply getting the lists of the current web, and displaying them in the dropdown-list.
SPListCollection lists = SPContext.Current.Web.Lists;
foreach (SPList list in lists)
ddl.Items.Add(list.Title);
tb = new TextBox();
tb.ID = "tb";
toolPartPanel.Controls.Add(ddl);
toolPartPanel.Controls.Add(tb);
Controls.Add(toolPartPanel);
base.CreateChildControls();
}
public override void ApplyChanges()
{
WebPart111 wp = (WebPart111)this.ParentToolPane.SelectedWebPart;
wp.Property1 = ddl.SelectedValue;
wp.Property2 = tb.Text;
}
}
}
简单的结果
![](http://pic002.cnblogs.com/img/geek007/200905/2009051311230713.jpg)
稍微复杂点的
![](http://pic002.cnblogs.com/img/geek007/200905/2009051311235097.jpg)
属性面板选list 的参见:http://www.tonstegeman.com/Blog/Lists/Posts/Post.aspx?List=70640fe5-28d9-464f-b1c9-91e07c8f7e47&ID=72
http://msdn.microsoft.com/en-us/library/dd584174.aspx
但是这个方式还是比较好的http://msdn.microsoft.com/en-us/library/dd584178(office.11).aspx
这也有一篇http://www.zimmergren.net/archive/2008/11/29/how-to-custom-web-part-properties-toolpart.aspx
webpart代码
Code
using System;
using System.Collections.Generic;
using System.Text;
using System.Web.UI;
using System.Web.UI.WebControls;
using Microsoft.SharePoint;
namespace Zimmergren.CustomToolPart
{
public class CustomToolPart : Microsoft.SharePoint.WebPartPages.ToolPart
{
DropDownList ddl;
Panel toolPartPanel;
TextBox tb;
protected override void CreateChildControls()
{
toolPartPanel = new Panel();
ddl = new DropDownList();
ddl.ID = "ddl";
// Simply getting the lists of the current web, and displaying them in the dropdown-list.
SPListCollection lists = SPContext.Current.Web.Lists;
foreach (SPList list in lists)
ddl.Items.Add(list.Title);
tb = new TextBox();
tb.ID = "tb";
toolPartPanel.Controls.Add(ddl);
toolPartPanel.Controls.Add(tb);
Controls.Add(toolPartPanel);
base.CreateChildControls();
}
public override void ApplyChanges()
{
WebPart111 wp = (WebPart111)this.ParentToolPane.SelectedWebPart;
wp.Property1 = ddl.SelectedValue;
wp.Property2 = tb.Text;
}
}
}
简单的结果
![](http://pic002.cnblogs.com/img/geek007/200905/2009051311230713.jpg)
稍微复杂点的
![](http://pic002.cnblogs.com/img/geek007/200905/2009051311235097.jpg)
属性面板选list 的参见:http://www.tonstegeman.com/Blog/Lists/Posts/Post.aspx?List=70640fe5-28d9-464f-b1c9-91e07c8f7e47&ID=72
相关文章推荐
- SharePoint 2010--为WebPart创建自定义属性
- sharepoint 2010 可视web部件 自定义属性 控件获取到自定义属性的值
- 使用TOOLPART定义WEBPART(web部件)的属性
- sharepoint 2010 如何扩展webpart自定义属性边栏字段 custom webpart properties
- SharePoint 2010--为WebPart创建自定义属性
- SharePoint 部件通过EditorPart自定义属性面板
- SharePoint 2013 WebPart属性面板配置
- SharePoint 部件通过EditorPart自定义属性面板
- SharePoint 部件通过EditorPart自定义属性面板
- sharepoint 2010 如何扩展webpart自定义属性边栏字段 custom webpart properties
- 通过javascript操作web控件的自定义属性
- 如何通过javascript操作web控件的自定义属性
- 如何在sharepoint 2013中创建自定义webpart
- SharePoint Web Service系列:编写自定义SharePoint Web Services之二
- Unity3D 使用 Editor 脚本,自定义 脚本的属性面板
- JAVAWEB开发之JSTL标签库的使用、 自定义EL函数、自定义标签(带属性的、带标签体的)
- JavaWeb开发之JSTL标签库的使用、 自定义EL函数、自定义标签(带属性的、带标签体的)
- SHAREPOINT自定义WEBPART的访问出现了403的错误,什么原因?
- 如何在SharePoint中配置和自定义Content Query Web Part(一)
- [转]如何在SharePoint中配置和自定义Content Query Web Part(二)