EditorPartCollectionとは? わかりやすく解説

EditorPartCollection クラス

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

WebPart コントロールのプロパティ、レイアウト、外観、および動作の編集に使用される EditorPart コントロールのコレクションを含みます。このクラスは継承できません。

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

Public NotInheritable Class
 EditorPartCollection
    Inherits ReadOnlyCollectionBase
Dim instance As EditorPartCollection
public sealed class EditorPartCollection :
 ReadOnlyCollectionBase
public ref class EditorPartCollection sealed
 : public ReadOnlyCollectionBase
public final class EditorPartCollection extends
 ReadOnlyCollectionBase
public final class EditorPartCollection extends
 ReadOnlyCollectionBase
解説解説
使用例使用例

EditorPartCollection クラスのいくつかの使用方法を次のコード例に示します。このコード例は 4 つの部分で構成されます。

コード例の最初の部分は、Web ページ上の表示モードをユーザーが変更できるようにするユーザー コントロールです。表示モードの詳細、およびこのコントロールのソース コードの説明については、「チュートリアル : Web パーツ ページでの表示モードの変更」を参照してください。

<%@ control language="vb" classname="DisplayModeMenuVB"%>

<script runat="server">
  
' Use a field to reference the current WebPartManager.
Dim _manager As WebPartManager


Sub Page_Init(ByVal sender As
 Object, ByVal e As EventArgs)
 
    AddHandler Page.InitComplete, AddressOf
 InitComplete

End Sub 


Sub InitComplete(ByVal sender As
 Object, ByVal e As System.EventArgs)
 
    _manager = WebPartManager.GetCurrentWebPartManager(Page)
    
    Dim browseModeName As String
 = _
      WebPartManager.BrowseDisplayMode.Name
    
    ' Fill the dropdown with the names of supported display modes.
    Dim mode As WebPartDisplayMode
    For Each mode In  _manager.SupportedDisplayModes
        Dim modeName As String
 = mode.Name
        ' Make sure a mode is enabled before adding it.
        If mode.IsEnabled(_manager) Then
        Dim item As New
 ListItem(modeName, modeName)
            DisplayModeDropdown.Items.Add(item)
        End If
    Next mode

End Sub 
 

' Change the page to the selected display mode.
  Sub DisplayModeDropdown_SelectedIndexChanged(ByVal
 sender As Object, _
    ByVal e As EventArgs)
    Dim selectedMode As String
 = DisplayModeDropdown.SelectedValue
    
    Dim mode As WebPartDisplayMode = _
      _manager.SupportedDisplayModes(selectedMode)
    If Not (mode Is Nothing)
 Then
      _manager.DisplayMode = mode
    End If
 
  End Sub


Sub Page_PreRender(ByVal sender As
 Object, ByVal e As EventArgs)
 
    DisplayModeDropdown.SelectedValue = _manager.DisplayMode.Name

End Sub 

</script>
<div>
  <asp:Panel ID="Panel1" runat="server"
 
    Borderwidth="1" 
    Width="125" 
    BackColor="lightgray"
    Font-Names="Verdana, Arial, Sans Serif" >
  <asp:Label ID="Label1" runat="server"
 
    Text="&nbsp;Display Mode" 
    Font-Bold="true"
    Font-Size="8"
    Width="120" />
  <asp:DropDownList ID="DisplayModeDropdown" 
    runat="server"  
    AutoPostBack="true" 
    Width="120"
    OnSelectedIndexChanged="DisplayModeDropdown_SelectedIndexChanged"
 />
  </asp:Panel>
</div>
<%@ control language="C#" classname="DisplayModeMenuCS"%>

<script runat="server">
  
 // Use a field to reference the current WebPartManager.
  WebPartManager _manager;

  void Page_Init(object sender, EventArgs e)
  {
    Page.InitComplete += new EventHandler(InitComplete);
  }  

  void InitComplete(object sender, System.EventArgs e)
  {
    _manager = WebPartManager.GetCurrentWebPartManager(Page);

    String browseModeName = WebPartManager.BrowseDisplayMode.Name;

    // Fill the dropdown with the names of supported display modes.
    foreach (WebPartDisplayMode mode in _manager.SupportedDisplayModes)
    {
      String modeName = mode.Name;
      // Make sure a mode is enabled before adding it.
      if (mode.IsEnabled(_manager))
      {
        ListItem item = new ListItem(modeName, modeName);
        DisplayModeDropdown.Items.Add(item);
      }
    }
  }
 
  // Change the page to the selected display mode.
  void DisplayModeDropdown_SelectedIndexChanged(object sender,
 
    EventArgs e)
  {
    String selectedMode = DisplayModeDropdown.SelectedValue;

    WebPartDisplayMode mode = 
      _manager.SupportedDisplayModes[selectedMode];
    if (mode != null)
      _manager.DisplayMode = mode;

  }

  void Page_PreRender(object sender, EventArgs e)
  {
    DisplayModeDropdown.SelectedValue = 
      _manager.DisplayMode.Name;
  }

</script>
<div>
  <asp:Panel ID="Panel1" runat="server" 
    Borderwidth="1" 
    Width="125" 
    BackColor="lightgray"
    Font-Names="Verdana, Arial, Sans Serif" >
  <asp:Label ID="Label1" runat="server" 
    Text="&nbsp;Display Mode" 
    Font-Bold="true"
    Font-Size="8"
    Width="120" />
  <asp:DropDownList ID="DisplayModeDropdown" 
    runat="server"  
    AutoPostBack="true" 
    Width="120"
    OnSelectedIndexChanged="DisplayModeDropdown_SelectedIndexChanged" />
  </asp:Panel>
</div>

コード例の 2 番目の部分は TextDisplayWebPart コントロールです。コード例を実行するためには、このソース コードをコンパイルする必要があります。それを明示的にコンパイルし、コンパイル済みのアセンブリを Web サイトの Bin フォルダまたはグローバル アセンブリ キャッシュに配置できます。サイトの App_Code フォルダにソース コードを配置し、実行時に動的にコンパイルすることもできます。両方のコンパイル方法を示すチュートリアルについては、「チュートリアル : カスタム サーバー コントロールの開発と使用」を参照してください。

コントロールには ContentText という名前のプロパティがあります。このプロパティは、ユーザーがテキスト ボックスに入力する値を保持します。このカスタム プロパティは、標準の WebPart コントロールのプロパティと共に、コントロールが編集モードの場合に編集できます。

Imports System
Imports System.Collections
Imports System.ComponentModel
Imports System.Drawing
Imports System.Security.Permissions
Imports System.Web
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports System.Web.UI.WebControls.WebParts

Namespace Samples.AspNet.VB.Controls

  <AspNetHostingPermission(SecurityAction.Demand, _
    Level:=AspNetHostingPermissionLevel.Minimal)> _
  <AspNetHostingPermission(SecurityAction.InheritanceDemand, _
    Level:=AspNetHostingPermissionLevel.Minimal)> _
  Public Class TextDisplayWebPart
    Inherits WebPart
    Private _contentText As String
 = Nothing
    Private _fontStyle As String
 = Nothing
    Private input As TextBox
    Private DisplayContent As Label
    Private lineBreak As Literal

    <Personalizable(), WebBrowsable()> _
    Public Property ContentText() As
 String
      Get
        Return _contentText
      End Get
      Set(ByVal value As
 String)
        _contentText = value
      End Set
    End Property

    Protected Overrides Sub
 CreateChildControls()
      Controls.Clear()
      DisplayContent = New Label()
      DisplayContent.BackColor = Color.LightBlue
      DisplayContent.Text = Me.ContentText
      Me.Controls.Add(DisplayContent)

      lineBreak = New Literal()
      lineBreak.Text = "<br />"
      Controls.Add(lineBreak)

      input = New TextBox()
      Me.Controls.Add(input)
      Dim update As New
 Button()
      update.Text = "Set Label Content"
      AddHandler update.Click, AddressOf Me.submit_Click
      Me.Controls.Add(update)

    End Sub

    Private Sub submit_Click(ByVal
 sender As Object, _
                             ByVal e As EventArgs)
      ' Update the label string.
      If input.Text <> String.Empty Then
        _contentText = input.Text + "<br />"
        input.Text = String.Empty
        DisplayContent.Text = Me.ContentText
      End If

    End Sub

  End Class

End Namespace
using System;
using System.Collections;
using System.ComponentModel;
using System.Drawing;
using System.Security.Permissions;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;

namespace Samples.AspNet.CS.Controls
{
  [AspNetHostingPermission(SecurityAction.Demand,
    Level = AspNetHostingPermissionLevel.Minimal)]
  [AspNetHostingPermission(SecurityAction.InheritanceDemand,
    Level = AspNetHostingPermissionLevel.Minimal)]
  public class TextDisplayWebPart : WebPart
  {
    private String _contentText = null;
    TextBox input;
    Label DisplayContent;
    Literal lineBreak;

    [Personalizable(), WebBrowsable]
    public String ContentText
    {
      get { return _contentText; }
      set { _contentText = value; }
    }

    protected override void CreateChildControls()
    {
      Controls.Clear();
      DisplayContent = new Label();
      DisplayContent.BackColor = Color.LightBlue;
      DisplayContent.Text = this.ContentText;
      this.Controls.Add(DisplayContent);

      lineBreak = new Literal();
      lineBreak.Text = @"<br />";
      Controls.Add(lineBreak);

      input = new TextBox();
      this.Controls.Add(input);
      Button update = new Button();
      update.Text = "Set Label Content";
      update.Click += new EventHandler(this.submit_Click);
      this.Controls.Add(update);

    }

    private void submit_Click(object sender,
 EventArgs e)
    {
      // Update the label string.
      if (input.Text != String.Empty)
      {
        _contentText = input.Text + @"<br />";
        input.Text = String.Empty;
        DisplayContent.Text = this.ContentText;
      }
    }

  }
}

コード例の 3 番目の部分は Web ページです。ページの <asp:editorzone> 要素には、3 つの EditorPart コントロールの宣言が含まれています。これらのコントロールのうち 2 つは、Button1_Click メソッドを実行したときに作成されるカスタム EditorPartCollection オブジェクトの一部となります。

<%@ page language="vb" %>
<%@ register TagPrefix="uc1" 
  TagName="DisplayModeMenu" 
  Src="DisplayModevb.ascx" %>
<%@ register tagprefix="aspSample" 
  Namespace="Samples.AspNet.VB.Controls"
 
  Assembly="TextDisplayWebPartVB"
 %>

<script runat="server">

  Protected Sub Button1_Click(ByVal
 sender As Object, _
    ByVal e As EventArgs)
    
    Dim list As New ArrayList(2)
    list.Add(AppearanceEditorPart1)
    list.Add(PropertyGridEditorPart1)
    ' Pass an ICollection object to the constructor.
    Dim myParts As New EditorPartCollection(list)
    Dim editor As EditorPart
    For Each editor In myParts
      editor.BackColor = System.Drawing.Color.LightBlue
      editor.Description = "My " + editor.DisplayTitle
 + " editor."
    Next editor
    
    ' Use the IndexOf property to locate an EditorPart control.
    Dim propertyGridPart As Integer
 = _
      myParts.IndexOf(PropertyGridEditorPart1)
    myParts(propertyGridPart).ChromeType = PartChromeType.TitleOnly
    
    ' Use the Contains method to see if an EditorPart exists.
    If Not myParts.Contains(LayoutEditorPart1)
 Then
      LayoutEditorPart1.BackColor = System.Drawing.Color.LightYellow
    End If
    
    ' Use the CopyTo method to create an array of EditorParts.
    Dim partArray(2) As EditorPart
    partArray(0) = LayoutEditorPart1
    myParts.CopyTo(partArray, 1)
    Label1.Text = "<h3>EditorParts in Custom Array</h3>"
    Dim ePart As EditorPart
    For Each ePart In partArray
      Label1.Text += ePart.Title + "<br />"
    Next ePart

  End Sub

</script>
<html>
  <head id="Head1" runat="server">
    <title>
      Text Display WebPart with AppearanceEditorPart
    </title>
  </head>
  <body>
    <form id="form1" runat="server">
      <asp:webpartmanager id="WebPartManager1"
 runat="server" />
      <uc1:DisplayModeMenu ID="DisplayModeMenu1"
 runat="server" />
      <asp:webpartzone id="zone1" runat="server">
        <zonetemplate>
          <aspSample:TextDisplayWebPart 
            runat="server"   
            id="textwebpart" 
            title = "Text Content WebPart" /> 
         
        </zonetemplate>
      </asp:webpartzone> 
      <asp:EditorZone ID="EditorZone1" runat="server">
        <ZoneTemplate>
          <asp:AppearanceEditorPart ID="AppearanceEditorPart1"
 
            runat="server" />
          <asp:LayoutEditorPart ID="LayoutEditorPart1"
 
            runat="server" />
          <asp:PropertyGridEditorPart ID="PropertyGridEditorPart1"
 
            runat="server" />
        </ZoneTemplate>      
      </asp:EditorZone>
      <asp:Button ID="Button1" runat="server"
 
        Text="Create EditorPartCollection" 
        OnClick="Button1_Click" />
      <asp:Label ID="Label1" runat="server"
 Text="" />
    </form>
  </body>
</html>
<%@ page language="c#" %>
<%@ register TagPrefix="uc1" 
  TagName="DisplayModeMenu" 
  Src="DisplayModecs.ascx" %>
<%@ register tagprefix="aspSample" 
  Namespace="Samples.AspNet.CS.Controls" 
  Assembly="TextDisplayWebPartCS" %>
  
<script runat="server">

  protected void Button1_Click(object sender,
 EventArgs e)
  {
    ArrayList list = new ArrayList(2);
    list.Add(AppearanceEditorPart1);
    list.Add(PropertyGridEditorPart1);
    // Pass an ICollection object to the constructor.
    EditorPartCollection myParts = new EditorPartCollection(list);
    foreach (EditorPart editor in myParts)
    {
      editor.BackColor = System.Drawing.Color.LightBlue;
      editor.Description = "My " + editor.DisplayTitle + " editor.";
    }

    // Use the IndexOf property to locate an EditorPart control.
    int propertyGridPart = myParts.IndexOf(PropertyGridEditorPart1);
    myParts[propertyGridPart].ChromeType = PartChromeType.TitleOnly;

    // Use the Contains method to see if an EditorPart exists.
    if(!myParts.Contains(LayoutEditorPart1))
      LayoutEditorPart1.BackColor = System.Drawing.Color.LightYellow;
    
    // Use the CopyTo method to create an array of EditorParts.
    EditorPart[] partArray = new EditorPart[3];
    partArray[0] = LayoutEditorPart1;
    myParts.CopyTo(partArray,1);
    Label1.Text = "<h3>EditorParts in Custom Array</h3>";
    foreach (EditorPart ePart in partArray)
    {
      Label1.Text += ePart.Title + "<br />";
    }

  }

</script>
<html>
  <head id="Head1" runat="server">
    <title>
      Text Display WebPart with AppearanceEditorPart
    </title>
  </head>
  <body>
    <form id="form1" runat="server">
      <asp:webpartmanager id="WebPartManager1" runat="server"
 />
      <uc1:DisplayModeMenu ID="DisplayModeMenu1" runat="server"
 />
      <asp:webpartzone id="zone1" runat="server">
        <zonetemplate>
          <aspSample:TextDisplayWebPart 
            runat="server"   
            id="textwebpart" 
            title = "Text Content WebPart" />          
        </zonetemplate>
      </asp:webpartzone> 
      <asp:EditorZone ID="EditorZone1" runat="server">
        <ZoneTemplate>
          <asp:AppearanceEditorPart ID="AppearanceEditorPart1" 
            runat="server" />
          <asp:LayoutEditorPart ID="LayoutEditorPart1" 
            runat="server" />
          <asp:PropertyGridEditorPart ID="PropertyGridEditorPart1" 
            runat="server" />
        </ZoneTemplate>      
      </asp:EditorZone>
      <asp:Button ID="Button1" runat="server" 
        Text="Create EditorPartCollection" 
        OnClick="Button1_Click" />
      <asp:Label ID="Label1" runat="server" Text=""
 />
    </form>
  </body>
</html>

ブラウザでページを読み込む場合、[Display Mode] ドロップダウン リスト コントロールの [編集] を選択することにより、ページを編集モードに切り替えることができます。TextDisplayWebPart コントロールのタイトル バーで動詞メニュー (下向きの矢印) をクリックし、[編集] をクリックすることにより、コントロールを編集できます。編集中のユーザー インターフェイス (UI) が表示状態の場合、すべての EditorPart コントロールを表示できます。[Create EditorPartCollection] ボタンをクリックして、EditorPartCollection オブジェクトを操作するコードによって作成される、EditorPart コントロールに対する効果を確認します。また、PropertyGridEditorPart コントロールを使用すると、カスタム TextDisplayWebPart.ContentText プロパティを編集できることも確認します。この操作が可能なのは、コントロールのソース コードでプロパティが WebBrowsable 属性でマークされているからです。編集中の UI でプロパティ値を更新する場合は、ページを通常のブラウズ モードに戻して、TextDisplayWebPart.ContentText プロパティの更新の効果を確認する必要があります。

.NET Framework のセキュリティ.NET Framework のセキュリティ
継承階層継承階層
System.Object
   System.Collections.ReadOnlyCollectionBase
    System.Web.UI.WebControls.WebParts.EditorPartCollection
スレッド セーフスレッド セーフ
この型の public static (Visual Basic では Shared) メンバはすべて、スレッド セーフです。インスタンス メンバの場合は、スレッド セーフであるとは限りません。
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
EditorPartCollection メンバ
System.Web.UI.WebControls.WebParts 名前空間
EditorPart クラス
その他の技術情報
ASP.NET Web パーツ ページ

EditorPartCollection コンストラクタ ()

メモ : このコンストラクタは、.NET Framework version 2.0 で新しく追加されたものです。

EditorPartCollection クラスの新しい空のインスタンスを初期化します。

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

Dim instance As New EditorPartCollection
public EditorPartCollection ()
public:
EditorPartCollection ()
public EditorPartCollection ()
public function EditorPartCollection ()
解説解説

EditorPartCollection コンストラクタは、EditorPartCollection クラスの空のインスタンスを初期化します。コンストラクタのこのオーバーロードは、EditorZone クラスによってその CreateEditorParts メソッドで内部で使用され、空のコレクション オブジェクトを作成します。次に、ゾーンは、子ゾーン テンプレートで宣言されたすべての EditorPart コントロールのインスタンスを作成し、内部メソッドを使用して、それらをコレクションに追加します。

EditorPartCollection コンストラクタのこのオーバーロードは、EditorPartCollection の新しいインスタンスの作成、およびそれに対する EditorPart コントロールの追加には使用できません。代わりに、EditorPartCollection コンストラクタの他のオーバーロードのいずれかを使用する必要があります。

プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

EditorPartCollection コンストラクタ (ICollection)

メモ : このコンストラクタは、.NET Framework version 2.0 で新しく追加されたものです。

EditorPart コントロールの ICollection コレクションを渡すことによって、EditorPartCollection クラスの新しいインスタンスを初期化します。

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

Public Sub New ( _
    editorParts As ICollection _
)
Dim editorParts As ICollection

Dim instance As New EditorPartCollection(editorParts)
public EditorPartCollection (
    ICollection editorParts
)
public:
EditorPartCollection (
    ICollection^ editorParts
)
public EditorPartCollection (
    ICollection editorParts
)
public function EditorPartCollection (
    editorParts : ICollection
)

パラメータ

editorParts

EditorPart コントロールの ICollection。

解説解説

EditorPartCollection コンストラクタは、EditorPartCollection クラスのインスタンスを初期化し、EditorPart コントロールのコレクションを渡します。これは、新しい EditorPartCollection オブジェクトの作成とそれに対する EditorPart コントロールの追加に使用できる、EditorPartCollection コンストラクタのオーバーロードの 1 つです。

コンストラクタによって作成された EditorPartCollection インスタンスが読み取り専用であっても、コレクション内の個別の EditorPart コントロールにプログラムによってアクセスし、そのプロパティおよびメソッドを呼び出すことはできます。

EditorPartCollection コンストラクタは、一般的に、EditorPart コントロールの全体のセットに対して、内容、外観、または関連するコントロール グループの位置の変更などのバッチ操作を行う場合に使用されます。

他に EditorPartCollection コンストラクタは、カスタム EditorPart コントロールの開発でも、このカスタム コントロールをサーバー コントロールに関連付けてユーザーが各自のコントロールのカスタム プロパティを編集できるようにする場合によく使用されます。このシナリオでは、サーバー コントロールは、IWebEditable インターフェイスを実装する必要があります。また、そのタスクの一部として、CreateEditorParts メソッドを実装する必要があります。そのメソッドでは、カスタム EditorPart コントロールでサーバー コントロールを編集できるように、EditorPart コントロールを、ArrayList オブジェクトなどの ICollection インスタンスに追加する必要があります。次に、EditorPart コントロールのコレクションを EditorPartCollection コンストラクタに渡して、新しい EditorPartCollection オブジェクトを作成できます。EditorZoneBase ゾーンは、これを使用してすべてのコントロールを設定し、編集プロセスを開始します。

使用例使用例

カスタム EditorPartCollection を作成し、コレクションが読み取り専用の場合でも、コレクション内の個別の EditorPart コントロールを変更するバッチ操作を実行する方法を次のコード例に示します。例の実行に必要なコード全体については、EditorPartCollection クラスの概要で「例」を参照してください。

Button1_Click イベント内のコードは、ArrayList オブジェクトを作成し、ページ内の 3 つの EditorPart コントロールのうち 2 つをオブジェクトに追加します。次に、EditorPartCollection コンストラクタを使用して、新しい EditorPartCollection オブジェクトを作成します。また、コレクションが読み取り専用であっても、基になる EditorPart コントロールを変更できる方法も示します。

<script runat="server">

  Protected Sub Button1_Click(ByVal
 sender As Object, _
    ByVal e As EventArgs)
    
    Dim list As New ArrayList(2)
    list.Add(AppearanceEditorPart1)
    list.Add(PropertyGridEditorPart1)
    ' Pass an ICollection object to the constructor.
    Dim myParts As New EditorPartCollection(list)
    Dim editor As EditorPart
    For Each editor In myParts
      editor.BackColor = System.Drawing.Color.LightBlue
      editor.Description = "My " + editor.DisplayTitle
 + " editor."
    Next editor
    
    ' Use the IndexOf property to locate an EditorPart control.
    Dim propertyGridPart As Integer
 = _
      myParts.IndexOf(PropertyGridEditorPart1)
    myParts(propertyGridPart).ChromeType = PartChromeType.TitleOnly
    
    ' Use the Contains method to see if an EditorPart exists.
    If Not myParts.Contains(LayoutEditorPart1)
 Then
      LayoutEditorPart1.BackColor = System.Drawing.Color.LightYellow
    End If
    
    ' Use the CopyTo method to create an array of EditorParts.
    Dim partArray(2) As EditorPart
    partArray(0) = LayoutEditorPart1
    myParts.CopyTo(partArray, 1)
    Label1.Text = "<h3>EditorParts in Custom Array</h3>"
    Dim ePart As EditorPart
    For Each ePart In partArray
      Label1.Text += ePart.Title + "<br />"
    Next ePart

  End Sub

</script>
<script runat="server">

  protected void Button1_Click(object sender,
 EventArgs e)
  {
    ArrayList list = new ArrayList(2);
    list.Add(AppearanceEditorPart1);
    list.Add(PropertyGridEditorPart1);
    // Pass an ICollection object to the constructor.
    EditorPartCollection myParts = new EditorPartCollection(list);
    foreach (EditorPart editor in myParts)
    {
      editor.BackColor = System.Drawing.Color.LightBlue;
      editor.Description = "My " + editor.DisplayTitle + " editor.";
    }

    // Use the IndexOf property to locate an EditorPart control.
    int propertyGridPart = myParts.IndexOf(PropertyGridEditorPart1);
    myParts[propertyGridPart].ChromeType = PartChromeType.TitleOnly;

    // Use the Contains method to see if an EditorPart exists.
    if(!myParts.Contains(LayoutEditorPart1))
      LayoutEditorPart1.BackColor = System.Drawing.Color.LightYellow;
    
    // Use the CopyTo method to create an array of EditorParts.
    EditorPart[] partArray = new EditorPart[3];
    partArray[0] = LayoutEditorPart1;
    myParts.CopyTo(partArray,1);
    Label1.Text = "<h3>EditorParts in Custom Array</h3>";
    foreach (EditorPart ePart in partArray)
    {
      Label1.Text += ePart.Title + "<br />";
    }

  }

</script>

ブラウザでページを読み込み、[Display Mode] ドロップダウン リスト コントロールの [編集] を選択することにより、ページを編集モードに切り替えることができます。TextDisplayWebPart コントロールのタイトル バーで動詞メニュー (下向きの矢印) をクリックし、[編集] をクリックすることにより、コントロールを編集できます。編集中のユーザー インターフェイス (UI) が表示状態の場合、すべての EditorPart コントロールを表示できます。[Create EditorPartCollection] ボタンをクリックして、EditorPartCollection オブジェクトに追加される 2 つの EditorPart コントロールに対する効果を確認します。

プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
EditorPartCollection クラス
EditorPartCollection メンバ
System.Web.UI.WebControls.WebParts 名前空間
IWebEditable
EditorParts
その他の技術情報
ASP.NET Web パーツ ページ

EditorPartCollection コンストラクタ (EditorPartCollection, ICollection)

メモ : このコンストラクタは、.NET Framework version 2.0 で新しく追加されたものです。

EditorPart コントロールの EditorPartCollection コレクション、および追加の EditorPart コントロールの ICollection コレクションを渡すことによって、EditorPartCollection クラスの新しいインスタンスを初期化します。

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

Public Sub New ( _
    existingEditorParts As EditorPartCollection, _
    editorParts As ICollection _
)
Dim existingEditorParts As EditorPartCollection
Dim editorParts As ICollection

Dim instance As New EditorPartCollection(existingEditorParts,
 editorParts)
public EditorPartCollection (
    EditorPartCollection existingEditorParts,
    ICollection editorParts
)
public:
EditorPartCollection (
    EditorPartCollection^ existingEditorParts, 
    ICollection^ editorParts
)
public EditorPartCollection (
    EditorPartCollection existingEditorParts, 
    ICollection editorParts
)
public function EditorPartCollection (
    existingEditorParts : EditorPartCollection, 
    editorParts : ICollection
)

パラメータ

existingEditorParts

ゾーン内の既存の EditorPart コントロールの ICollection。

editorParts

ゾーン内にはないがプログラムで作成された、EditorPart コントロールの ICollection。

プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
EditorPartCollection クラス
EditorPartCollection メンバ
System.Web.UI.WebControls.WebParts 名前空間
その他の技術情報
ASP.NET Web パーツ ページ

EditorPartCollection コンストラクタ

EditorPartCollection クラスの新しいインスタンスを初期化します。 ASP.NET Web パーツ ページ
オーバーロードの一覧オーバーロードの一覧

名前 説明
EditorPartCollection () EditorPartCollection クラスの新しい空のインスタンスを初期化します。
EditorPartCollection (ICollection) EditorPart コントロールの ICollection コレクションを渡すことによって、EditorPartCollection クラスの新しいインスタンスを初期化します。
EditorPartCollection (EditorPartCollection, ICollection) EditorPart コントロールの EditorPartCollection コレクション、および追加の EditorPart コントロールの ICollection コレクションを渡すことによって、EditorPartCollection クラスの新しいインスタンスを初期化します。
参照参照

関連項目

EditorPartCollection クラス
EditorPartCollection メンバ
System.Web.UI.WebControls.WebParts 名前空間

その他の技術情報

ASP.NET Web パーツ ページ
ASP.NET Web パーツ ページ

EditorPartCollection フィールド


パブリック フィールドパブリック フィールド

参照参照

関連項目

EditorPartCollection クラス
System.Web.UI.WebControls.WebParts 名前空間
EditorPart クラス

その他の技術情報

ASP.NET Web パーツ ページ

EditorPartCollection プロパティ


パブリック プロパティパブリック プロパティ

プロテクト プロパティプロテクト プロパティ
  名前 説明
プロテクト プロパティ InnerList  ReadOnlyCollectionBase インスタンスに格納されている要素のリストを取得します。 ( ReadOnlyCollectionBase から継承されます。)
参照参照

関連項目

EditorPartCollection クラス
System.Web.UI.WebControls.WebParts 名前空間
EditorPart クラス

その他の技術情報

ASP.NET Web パーツ ページ

EditorPartCollection メソッド


パブリック メソッドパブリック メソッド

プロテクト メソッドプロテクト メソッド
参照参照

関連項目

EditorPartCollection クラス
System.Web.UI.WebControls.WebParts 名前空間
EditorPart クラス

その他の技術情報

ASP.NET Web パーツ ページ

EditorPartCollection メンバ

WebPart コントロールのプロパティ、レイアウト、外観、および動作の編集に使用される EditorPart コントロールのコレクションを含みます。このクラスは継承できません。

EditorPartCollection データ型で公開されるメンバを以下の表に示します。


パブリック コンストラクタパブリック コンストラクタ
  名前 説明
パブリック メソッド EditorPartCollection オーバーロードされます。 EditorPartCollection クラスの新しいインスタンスを初期化します。
パブリック フィールドパブリック フィールド
パブリック プロパティパブリック プロパティ
プロテクト プロパティプロテクト プロパティ
  名前 説明
プロテクト プロパティ InnerList  ReadOnlyCollectionBase インスタンスに格納されている要素のリストを取得します。(ReadOnlyCollectionBase から継承されます。)
パブリック メソッドパブリック メソッド
プロテクト メソッドプロテクト メソッド
参照参照

関連項目

EditorPartCollection クラス
System.Web.UI.WebControls.WebParts 名前空間
EditorPart クラス

その他の技術情報

ASP.NET Web パーツ ページ



英和和英テキスト翻訳

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

辞書ショートカット

すべての辞書の索引

「EditorPartCollection」の関連用語

EditorPartCollectionのお隣キーワード
検索ランキング

   

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



EditorPartCollectionのページの著作権

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

©2026 GRAS Group, Inc.RSS