2012-03-20 15 views

答えて

1

のEditorPartクラス:

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

それは代わりに帰属特性のために、このエディタの一部を使用する必要があることをWebパーツを知らせます。

の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

+0

答えが助けたが、私は評判のように十分なポイントを持っていけないので、残念ながら私はまだ投票をアップカント:( – bkk

+0

私はあなたに感謝している必要がありますありがとうMinMin :) もう1つの質問タイトルセクションTweetPartプロパティセクションの最小化アイコンが右側にあり、組み込みの "+"と同じではありません。同じ方法を実装する方法はありますか? – bkk

+0

ヘッダータイトルのHTMLマークアップとCSSは、EditorPartクラスから生成されます。このクラスからデフォルトの外観をオーバーライドできるかもしれません。私はわかりません。もっと調べたい場合は、この文書をチェックしてください。 (http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.webparts.editorpart.aspx)。そして、ページからCSSとHTMLを分析するための 'IE Developer Toolbar'のようなツールがあれば、非常に役に立ちます。 –

関連する問題