如何在SharePoint WebParts中设置EditorPart标头?

时间:2012-03-20 14:35:15

标签: sharepoint web-parts

我正在尝试为自定义编辑器部件部分设置标头。任何想法怎么做?

1 个答案:

答案 0 :(得分:1)

EditorPart Class:

public class YourCustomEditorPart:System.Web.UI.WebControls.WebParts.EditorPart{
   protected override void CreateChildControls() {
      this.Title = "Editor Part Title Here";
      ...
   }
}

告诉网络部分它应该使用此编辑器部分,而不是属性属性。

WebPart类:

public class YourWebPart:System.Web.UI.WebControls.WebParts.WebPart, IWebEditable {
...
EditorPartCollection IWebEditable.CreateEditorParts() {
    // control the editorparts
    List<EditorPart> editors = new List<EditorPart>();
    YourCustomEditorPart editorPart = new YourCustomEditorPart();
    editorPart.ID = this.ID + "_editorPart";
    editors.Add(editorPart);
    return new EditorPartCollection(editors);
    }
...
}

查看以下系列了解详情。 (包括下载源代码)

http://www.wictorwilen.se/Post/Web-Part-Properties-part-1-introduction.aspx

http://www.wictorwilen.se/Post/Web-Part-Properties-part-2-Editor-Parts.aspx