IWebEditable.CreateEditorParts メソッドとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > IWebEditable.CreateEditorParts メソッドの意味・解説 

IWebEditable.CreateEditorParts メソッド

メモ : このメソッドは、.NET Framework version 2.0 で新しく追加されたものです。

IWebEditable インターフェイスを実装するサーバー コントロールに関連付けられているカスタム EditorPart コントロールのコレクションを返します。

名前空間: System.Web.UI.WebControls.WebParts
アセンブリ: System.Web (system.web.dll 内)
構文構文

Function CreateEditorParts As EditorPartCollection
Dim instance As IWebEditable
Dim returnValue As EditorPartCollection

returnValue = instance.CreateEditorParts
EditorPartCollection CreateEditorParts ()
EditorPartCollection^ CreateEditorParts ()
EditorPartCollection CreateEditorParts ()
function CreateEditorParts () : EditorPartCollection

戻り値
サーバー コントロールに関連付けられているカスタム EditorPart コントロールのコレクションを格納する EditorPartCollection。

解説解説

CreateEditorParts メソッドを使用すると、独自のカスタム コントロールに関連付けられているすべてのカスタム EditorPart コントロール、WebPart コントロール、またはユーザー コントロールのコレクションを作成し、それらを EditorPartCollection オブジェクトとして返すことができます。WebPartManager コントロールは、サーバー コントロールが編集モードになるたびに、コレクションを取得し、すべての EditorPart コントロールのインスタンスを作成します。

通常、このメソッドは、カスタム WebPart コントロールでその CreateEditorParts メソッドをオーバーライドすることで実装します。このメソッドでは、ユーザーのコントロールに関連付けるカスタム EditorPart コントロールのインスタンスを作成し、それらを EditorPartCollection オブジェクトに追加して、そのオブジェクトを返します。EditorPart コントロールのコレクションは、その後 EditorZoneBase ゾーンの EditorParts プロパティに代入されます。

メモメモ

CreateEditorParts メソッドの実装で EditorPart コントロールのコレクションに追加される EditorPart は、その ID プロパティに代入された値を保持する必要があります。そうしない場合、コレクションを EditorParts プロパティに代入すると例外がスローされます。

実装時の注意 CreateEditorParts メソッドが返す EditorPartCollection オブジェクトは読み取り専用で、そのオブジェクトにアクセスして個別のコントロールを追加するメソッドはありません。ただし、そのメソッドのオーバーライドまたは実装では、すべてのカスタム EditorPart コントロールを格納する ArrayList などの別の種類の ICollection オブジェクトを作成し、新しい EditorPartCollection オブジェクトを作成するときにそれをコンストラクタに渡すことができます。コード例については、「使用例」のセクションを参照してください。

使用例使用例

カスタム WebPart コントロールでの CreateEditorParts メソッドのオーバーライドを次のコード例に示します。この例を実行するために必要な完全なソース コードは、IWebEditable クラスの概要トピックにある「例」のセクションを参照してください。

コード例には、IWebEditable インターフェイスの両方のメンバが含まれます。CreateEditorParts メソッドのオーバーライドは、ArrayList を作成して、1 つ以上のカスタム EditorPart コントロールを収集し、そのリストを使用して EditorPartCollection オブジェクトを作成します。

Public Overrides Function
 CreateEditorParts() _
                            As EditorPartCollection
  Dim editorArray As New
 ArrayList()
  Dim edPart as New TextDisplayEditorPart()
  edPart.ID = Me.ID & "_editorPart1"
  editorArray.Add(edPart)
  Dim editorParts As New
 EditorPartCollection(editorArray)
  Return editorParts

End Function

Public Overrides ReadOnly
 Property WebBrowsableObject() _
                                    As Object
  Get
    Return Me
  End Get
End Property
public override EditorPartCollection CreateEditorParts()
{
  ArrayList editorArray = new ArrayList();
  TextDisplayEditorPart edPart = new TextDisplayEditorPart();
  edPart.ID = this.ID + "_editorPart1";
  editorArray.Add(edPart);
  EditorPartCollection editorParts = 
    new EditorPartCollection(editorArray);
  return editorParts;
}

public override object WebBrowsableObject
{
  get { return this; }
}
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照



英和和英テキスト翻訳

英語⇒日本語日本語⇒英語

辞書ショートカット

すべての辞書の索引

IWebEditable.CreateEditorParts メソッドのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



IWebEditable.CreateEditorParts メソッドのページの著作権

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2026 Microsoft.All rights reserved.

©2026 GRAS Group, Inc.RSS