如何在SharePoint Web部件中设置EditorPart标头?

如何在SharePoint Web部件中设置EditorPart标头?,sharepoint,web-parts,Sharepoint,Web Parts,我正在尝试设置自定义编辑器部分的标题。有什么办法吗?编辑课: public class YourCustomEditorPart:System.Web.UI.WebControls.WebParts.EditorPart{ protected override void CreateChildControls() { this.Title = "Editor Part Title Here"; ... } } public class YourWebPart

我正在尝试设置自定义编辑器部分的标题。有什么办法吗?

编辑课:

public class YourCustomEditorPart:System.Web.UI.WebControls.WebParts.EditorPart{
   protected override void CreateChildControls() {
      this.Title = "Editor Part Title Here";
      ...
   }
}
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);
    }
...
}
告诉web部件它应该使用此编辑器部件,而不是属性化属性

Web部件类:

public class YourCustomEditorPart:System.Web.UI.WebControls.WebParts.EditorPart{
   protected override void CreateChildControls() {
      this.Title = "Editor Part Title Here";
      ...
   }
}
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);
    }
...
}
公共类YourWebPart:System.Web.UI.WebControl.WebParts.WebPart,可编辑{
...
EditorPartCollection IWebEditable.CreateEditorParts(){
//控制编辑器部件
列表编辑器=新列表();
YourCustomEditorPart editorPart=新建YourCustomEditorPart();
editorPart.ID=this.ID+“_editorPart”;
editors.Add(editorPart);
返回新的EditorPartCollection(编辑器);
}
...
}
查看以下系列了解详细信息。(包括下载源代码)


答案有帮助,但不幸的是,我还不能投票,因为我没有足够的分数作为声誉:(我应该在上一篇文章中感谢你,最好不要迟到。谢谢MinMin:)还有一个问题,在标题部分TweetPart属性中,最小化部分图标位于右侧,与内置的“+”不同。有没有办法实现相同的功能?标题的Html标记和css是从EditorPart类生成的。可能是,您可以重写此类中的默认外观。我不确定。如果您想了解更多信息,请查看此文档。(). 若你们有像“IE开发者工具栏”这样的工具来分析网页上的css和html,那个将非常有用。再次感谢MinMin。感谢您花时间和精力帮助我。@bkk您知道如何操作标题样式吗?我更愿意以与其他类别相同的方式设计标题。