LayoutEditorPart イベント

名前 | 説明 | |
---|---|---|
![]() | DataBinding | サーバー コントロールがデータ ソースに連結すると発生します。 ( Control から継承されます。) |
![]() | Disposed | サーバー コントロールがメモリから解放されると発生します。これは、ASP.NET ページが要求されている場合のサーバー コントロールの有効期間における最終段階です。 ( Control から継承されます。) |
![]() | Init | サーバー コントロールが初期化されると発生します。これは、サーバー コントロールの有効期間における最初の手順です。 ( Control から継承されます。) |
![]() | Load | サーバー コントロールが Page オブジェクトに読み込まれると発生します。 ( Control から継承されます。) |
![]() | PreRender | Control オブジェクトの読み込み後、表示を開始する前に発生します。 ( Control から継承されます。) |
![]() | Unload | サーバー コントロールがメモリからアンロードされると発生します。 ( Control から継承されます。) |

LayoutEditorPart クラス
アセンブリ: System.Web (system.web.dll 内)


LayoutEditorPart クラスは、EditorPart クラスから派生するエディタ コントロールであり、関連付けられた WebPart コントロールまたは GenericWebPart コントロールのレイアウトに影響するプロパティの編集に使用されます。
Web パーツ コントロール セット (詳細については ToolZone クラスの概要を参照) 内にツール指向のゾーンがあるように、ツール指向のパーツ コントロール (ツール パーツ) があり、各ツール パーツは特定のタイプのツール ゾーンに配置する必要があります。Web パーツ コントロール セットのツール パーツには、2 つの際立った特性があります。
LayoutEditorPart コントロールは、Web パーツ ページが編集モードの場合、および編集のために特定の WebPart コントロールが選択されている場合にのみ表示されるツール パーツです。LayoutEditorPart コントロールは、他のすべての EditorPart コントロールと同じように、EditorZone コントロールに配置されます。
![]() |
---|
EditorZone ゾーンには、EditorPart コントロールだけを格納できます。EditorPart コントロールを他のタイプのゾーンに配置することはできません。 |
LayoutEditorPart クラスには、レイアウト コントロールのタイトルを取得または設定する Title プロパティがあります。このクラスには、基本プロパティをオーバーライドして true を返す Display プロパティもあります。これは、編集される WebPart コントロールの AllowEdit プロパティが false に設定されていても、ページが編集モードの場合は LayoutEditorPart コントロールが常に表示されることを意味します。つまり、ユーザーは、指定した WebPart コントロールを他の EditorPart コントロールでは編集できない場合でも、常に LayoutEditorPart コントロールのプロパティを編集できます。
LayoutEditorPart クラスには、2 つの重要なメソッド ApplyChanges および SyncChanges もあります。これらは EditorPart クラスから継承され、オーバーライドされます。これらのメソッドが重要なのは、エディタ コントロールのフィールド値と、編集対象の WebPart コントロールのプロパティ間でのプロパティ値の取得または設定を可能にするからです。
ほとんどの場合、LayoutEditorPart コントロールをページ内で永続形式で使用する必要があります。このためには、<asp:layouteditorpart> 要素を <zonetemplate> 要素内で宣言します。同様にこの要素は Web ページ上の <asp:editorzone> 要素によって格納されます。LayoutEditorPart コントロールを使用して、エンド ユーザーは、次に示す WebPart コントロールの UI プロパティを編集できます。
-
ChromeState
-
ZoneIndex
WebPart コントロールの他のプロパティおよび動作を編集するには、Web パーツ コントロール セットで提供される他の EditorPart コントロールを使用できます。これらのコントロールには、BehaviorEditorPart、AppearanceEditorPart、PropertyGridEditorPart などのコントロールがあります。提供されている EditorPart コントロールでは、WebPart コントロールの編集に必要な編集機能のほとんどが提供されますが、EditorPart クラスから継承する方法でカスタムのエディタ コントロールを作成することもできます。コード例については、EditorPart クラスの概要を参照してください。
![]() |
---|
ユーザー補助を向上させるには、LayoutEditorPart コントロールを <fieldset> 要素内に表示します。<fieldset> 要素は、LayoutEditorPart コントロール内で編集に使用される関連コントロール セットをグループ化します。ビジュアル ユーザー エージェント (通常の Web ブラウザなど) および音声指向のユーザー エージェント (画面読み取りソフトウェアなど) の両方で、それらのグループ化されたコントロール間をタブで簡単に移動できます。 |
ユーザー補助

Web ページ内で LayoutEditorPart コントロールを宣言し、それで WebPart コントロールの複数の UI プロパティを編集できるようにする方法を次のコード例に示します。コード例は、次の 3 つの部分から成ります。
コード例の最初の部分は、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 ' If shared scope is allowed for this user, display the scope-switching ' UI and select the appropriate radio button for the current user scope. If _manager.Personalization.CanEnterSharedScope Then Panel2.Visible = True If _manager.Personalization.Scope = PersonalizationScope.User Then RadioButton1.Checked = True Else RadioButton2.Checked = True End If End If 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 ' Set the selected item equal to the current display mode. Sub Page_PreRender(ByVal sender As Object, ByVal e As EventArgs) Dim items As ListItemCollection = DisplayModeDropdown.Items Dim selectedIndex As Integer = _ items.IndexOf(items.FindByText(_manager.DisplayMode.Name)) DisplayModeDropdown.SelectedIndex = selectedIndex End Sub ' Reset all of a user's personalization data for the page. Protected Sub LinkButton1_Click(ByVal sender As Object, _ ByVal e As EventArgs) _manager.Personalization.ResetPersonalizationState() End Sub ' If not in User personalization scope, toggle into it. Protected Sub RadioButton1_CheckedChanged(ByVal sender As Object, _ ByVal e As EventArgs) If _manager.Personalization.Scope = PersonalizationScope.Shared Then _manager.Personalization.ToggleScope() End If End Sub ' If not in Shared scope, and if user is allowed, toggle the scope. Protected Sub RadioButton2_CheckedChanged(ByVal sender As Object, _ ByVal e As EventArgs) If _manager.Personalization.CanEnterSharedScope AndAlso _ _manager.Personalization.Scope = PersonalizationScope.User Then _manager.Personalization.ToggleScope() End If End Sub </script> <div> <asp:Panel ID="Panel1" runat="server" Borderwidth="1" Width="230" BackColor="lightgray" Font-Names="Verdana, Arial, Sans Serif" > <asp:Label ID="Label1" runat="server" Text=" Display Mode" Font-Bold="true" Font-Size="8" Width="120" /> <asp:DropDownList ID="DisplayModeDropdown" runat="server" AutoPostBack="true" Width="120" OnSelectedIndexChanged="DisplayModeDropdown_SelectedIndexChanged" /> <asp:LinkButton ID="LinkButton1" runat="server" Text="Reset User State" ToolTip="Reset the current user's personalization data for the page." Font-Size="8" OnClick="LinkButton1_Click" /> <asp:Panel ID="Panel2" runat="server" GroupingText="Personalization Scope" Font-Bold="true" Font-Size="8" Visible="false" > <asp:RadioButton ID="RadioButton1" runat="server" Text="User" AutoPostBack="true" GroupName="Scope" OnCheckedChanged="RadioButton1_CheckedChanged" /> <asp:RadioButton ID="RadioButton2" runat="server" Text="Shared" AutoPostBack="true" GroupName="Scope" OnCheckedChanged="RadioButton2_CheckedChanged" /> </asp:Panel> </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); } } // If shared scope is allowed for this user, display the scope-switching // UI and select the appropriate radio button for the current user scope. if (_manager.Personalization.CanEnterSharedScope) { Panel2.Visible = true; if (_manager.Personalization.Scope == PersonalizationScope.User) RadioButton1.Checked = true; else RadioButton2.Checked = true; } } // 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; } // Set the selected item equal to the current display mode. void Page_PreRender(object sender, EventArgs e) { ListItemCollection items = DisplayModeDropdown.Items; int selectedIndex = items.IndexOf(items.FindByText(_manager.DisplayMode.Name)); DisplayModeDropdown.SelectedIndex = selectedIndex; } // Reset all of a user's personalization data for the page. protected void LinkButton1_Click(object sender, EventArgs e) { _manager.Personalization.ResetPersonalizationState(); } // If not in User personalization scope, toggle into it. protected void RadioButton1_CheckedChanged(object sender, EventArgs e) { if (_manager.Personalization.Scope == PersonalizationScope.Shared) _manager.Personalization.ToggleScope(); } // If not in Shared scope, and if user is allowed, toggle the scope. protected void RadioButton2_CheckedChanged(object sender, EventArgs e) { if (_manager.Personalization.CanEnterSharedScope && _manager.Personalization.Scope == PersonalizationScope.User) _manager.Personalization.ToggleScope(); } </script> <div> <asp:Panel ID="Panel1" runat="server" Borderwidth="1" Width="230" BackColor="lightgray" Font-Names="Verdana, Arial, Sans Serif" > <asp:Label ID="Label1" runat="server" Text=" Display Mode" Font-Bold="true" Font-Size="8" Width="120" /> <asp:DropDownList ID="DisplayModeDropdown" runat="server" AutoPostBack="true" Width="120" OnSelectedIndexChanged="DisplayModeDropdown_SelectedIndexChanged" /> <asp:LinkButton ID="LinkButton1" runat="server" Text="Reset User State" ToolTip="Reset the current user's personalization data for the page." Font-Size="8" OnClick="LinkButton1_Click" /> <asp:Panel ID="Panel2" runat="server" GroupingText="Personalization Scope" Font-Bold="true" Font-Size="8" Visible="false" > <asp:RadioButton ID="RadioButton1" runat="server" Text="User" AutoPostBack="true" GroupName="Scope" OnCheckedChanged="RadioButton1_CheckedChanged" /> <asp:RadioButton ID="RadioButton2" runat="server" Text="Shared" AutoPostBack="true" GroupName="Scope" OnCheckedChanged="RadioButton2_CheckedChanged" /> </asp:Panel> </asp:Panel> </div>
コード例の 2 番目の部分は Web ページです。ここには、EditorZone コントロールへの宣言参照、および子の <zonetemplate> 要素が含まれます。この子要素には LayoutEditorPart コントロールへの宣言参照が含まれています。ページには、Pubs データベースにバインドされた BulletedList コントロールも含まれています。このコントロールは WebPartZone ゾーンに配置されているので、LayoutEditorPart コントロールで編集できる WebPart コントロールとして機能します。
<%@ Page Language="VB" %> <%@ Register Src="~/displayModeMenuVB.ascx" TagPrefix="uc1" TagName="DisplayModeMenuVB" %> <script runat="server"> Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Button1.Visible = False TextBox1.Visible = False BulletedList1.DataBind() End Sub Protected Sub Button1_Click(ByVal sender As Object, _ ByVal e As System.EventArgs) LayoutEditorPart1.Title = Server.HtmlEncode(TextBox1.Text) End Sub Protected Sub LayoutEditorPart1_PreRender(ByVal sender As Object, _ ByVal e As System.EventArgs) Button1.Visible = True TextBox1.Visible = True End Sub </script> <html > <head runat="server"> </head> <body> <form id="form1" runat="server"> <!-- This example uses Microsoft SQL Server and connects --> <!-- to the Pubs sample database. Use an ASP.NET expression --> <!-- like the one in the following control to retrieve the --> <!-- connection string value from the Web.config file. --> <asp:SqlDataSource ID="ds1" runat="server" connectionString="<%$ ConnectionStrings:PubsConnection %>" SelectCommand="Select au_id, au_lname, au_fname From Authors"/> <asp:WebPartManager ID="WebPartManager1" runat="server" /> <uc1:DisplayModeMenuVB id="menu1" runat="server" /> <asp:WebPartZone ID="WebPartZone1" runat="server" Width="150" style="z-index: 100; left: 10px; position: absolute; top: 90px" > <ZoneTemplate> <asp:Panel ID="panel1" runat="server" Title="Author List WebPart"> <asp:Label ID="Label1" runat="server" Text="Author Names" Font-Bold="true" Font-Size="120%"/> <asp:BulletedList ID="BulletedList1" runat="server" DataSourceID="ds1" DataTextField="au_lname" DataValueField="au_id"/> </asp:Panel> </ZoneTemplate> </asp:WebPartZone> <asp:WebPartZone ID="WebPartZone2" runat="server" Width="150" style="z-index: 101; left: 170px; position: absolute; top: 90px" /> <asp:EditorZone ID="EditorZone1" runat="server" style="z-index: 102; left: 340px; position: absolute; top: 90px" Width="170px"> <ZoneTemplate> <asp:LayoutEditorPart ID="LayoutEditorPart1" runat="server" Title="My Layout Editor" OnPreRender="LayoutEditorPart1_PreRender" /> </ZoneTemplate> </asp:EditorZone> <asp:Button ID="Button1" runat="server" Width="140" Text="Update EditorPart Title" style="left: 340px; position: absolute; top: 65px; z-index: 103;" OnClick="Button1_Click" /> <asp:TextBox ID="TextBox1" runat="server" style="z-index: 105; left: 500px; position: absolute; top: 65px" /> </form> </body> </html>
<%@ Page Language="C#" %> <%@ Register Src="~/displayModeMenuCS.ascx" TagPrefix="uc1" TagName="DisplayModeMenuCS" %> <script runat="server"> protected void Page_Load(object sender, EventArgs e) { Button1.Visible = false; TextBox1.Visible = false; BulletedList1.DataBind(); } protected void Button1_Click(object sender, EventArgs e) { LayoutEditorPart1.Title = Server.HtmlEncode(TextBox1.Text); } protected void LayoutEditorPart1_PreRender(object sender, EventArgs e) { Button1.Visible = true; TextBox1.Visible = true; } </script> <html > <head runat="server"> </head> <body> <form id="form1" runat="server"> <!-- This example uses Microsoft SQL Server and connects --> <!-- to the Pubs sample database. Use an ASP.NET expression --> <!-- like the one in the following control to retrieve the --> <!-- connection string value from the Web.config file. --> <asp:SqlDataSource ID="ds1" runat="server" connectionString="<%$ ConnectionStrings:PubsConnection %>" SelectCommand="Select au_id, au_lname, au_fname From Authors"/> <asp:WebPartManager ID="WebPartManager1" runat="server" /> <uc1:DisplayModeMenuCS id="menu1" runat="server" /> <asp:WebPartZone ID="WebPartZone1" runat="server" Width="150" style="z-index: 100; left: 10px; position: absolute; top: 90px" > <ZoneTemplate> <asp:Panel ID="panel1" runat="server" Title="Author List WebPart"> <asp:Label ID="Label1" runat="server" Text="Author Names" Font-Bold="true" Font-Size="120%"/> <asp:BulletedList ID="BulletedList1" runat="server" DataSourceID="ds1" DataTextField="au_lname" DataValueField="au_id"/> </asp:Panel> </ZoneTemplate> </asp:WebPartZone> <asp:WebPartZone ID="WebPartZone2" runat="server" Width="150" style="z-index: 101; left: 170px; position: absolute; top: 90px" /> <asp:EditorZone ID="EditorZone1" runat="server" style="z-index: 102; left: 340px; position: absolute; top: 90px" Width="170px"> <ZoneTemplate> <asp:LayoutEditorPart ID="LayoutEditorPart1" runat="server" Title="My Layout Editor" OnPreRender="LayoutEditorPart1_PreRender" /> </ZoneTemplate> </asp:EditorZone> <asp:Button ID="Button1" runat="server" Width="140" Text="Update EditorPart Title" style="left: 340px; position: absolute; top: 65px; z-index: 103;" OnClick="Button1_Click" /> <asp:TextBox ID="TextBox1" runat="server" style="z-index: 105; left: 500px; position: absolute; top: 65px" /> </form> </body> </html>
ブラウザでページを読み込む場合、[Display Mode] ドロップダウン リスト コントロールで [編集モード] を選択して、編集モードに切り替えることができます。Author List WebPart コントロールのタイトル バーで動詞メニュー (下向きの矢印) をクリックし、[編集] をクリックすることにより、コントロールを編集できます。編集中の UI が表示状態の場合、LayoutEditorPart コントロールが表示され、ボタンおよびテキスト ボックスがその上に配置されます。編集中の UI で変更を行い、[適用] ボタンをクリックした場合、[Display Mode] ドロップダウン リスト コントロールを使用して、ページをブラウズ モードに戻し、編集中の変更をすべて反映した結果を表示できます。


System.Web.UI.Control
System.Web.UI.WebControls.WebControl
System.Web.UI.WebControls.Panel
System.Web.UI.WebControls.WebParts.Part
System.Web.UI.WebControls.WebParts.EditorPart
System.Web.UI.WebControls.WebParts.LayoutEditorPart


Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


LayoutEditorPart コンストラクタ
アセンブリ: System.Web (system.web.dll 内)


LayoutEditorPart コンストラクタは既定です。LayoutEditorPart クラスで宣言されるコンストラクタはないので、クラスの新しいインスタンスが作成される場合に特別なタスクは実行されません。
通常、コンストラクタを使用する必要はありません。これは、デザイン時の宣言で LayoutEditorPart コントロールをページに追加できるからです。ただし、何らかの理由で LayoutEditorPart コントロールをプログラムによって追加する必要がある場合は、LayoutEditorPart コンストラクタを使用できます。

Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


LayoutEditorPart プロパティ


LayoutEditorPart メソッド


名前 | 説明 | |
---|---|---|
![]() | Finalize | Object がガベージ コレクションにより収集される前に、その Object がリソースを解放し、その他のクリーンアップ操作を実行できるようにします。 ( Object から継承されます。) |
![]() | MemberwiseClone | 現在の Object の簡易コピーを作成します。 ( Object から継承されます。) |

LayoutEditorPart メンバ
関連付けられた WebPart コントロールで複数のレイアウト指向のユーザー インターフェイス (UI) プロパティをエンド ユーザーが編集できるようにするエディタ コントロールを提供します。このクラスは継承できません。
LayoutEditorPart データ型で公開されるメンバを以下の表に示します。




名前 | 説明 | |
---|---|---|
![]() | Finalize | Object がガベージ コレクションにより収集される前に、その Object がリソースを解放し、その他のクリーンアップ操作を実行できるようにします。 (Object から継承されます。) |
![]() | MemberwiseClone | 現在の Object の簡易コピーを作成します。 (Object から継承されます。) |

名前 | 説明 | |
---|---|---|
![]() | DataBinding | サーバー コントロールがデータ ソースに連結すると発生します。(Control から継承されます。) |
![]() | Disposed | サーバー コントロールがメモリから解放されると発生します。これは、ASP.NET ページが要求されている場合のサーバー コントロールの有効期間における最終段階です。(Control から継承されます。) |
![]() | Init | サーバー コントロールが初期化されると発生します。これは、サーバー コントロールの有効期間における最初の手順です。(Control から継承されます。) |
![]() | Load | サーバー コントロールが Page オブジェクトに読み込まれると発生します。(Control から継承されます。) |
![]() | PreRender | Control オブジェクトの読み込み後、表示を開始する前に発生します。(Control から継承されます。) |
![]() | Unload | サーバー コントロールがメモリからアンロードされると発生します。(Control から継承されます。) |

Weblioに収録されているすべての辞書からLayoutEditorPartを検索する場合は、下記のリンクをクリックしてください。

- LayoutEditorPartのページへのリンク