WebPart.Zone プロパティ
アセンブリ: System.Web (system.web.dll 内)

現在 Web ページの Web パーツ コントロールを格納している WebPartZoneBase。Web パーツ コントロールが現在ページで終了されている場合、戻り値は null 参照 (Visual Basic では Nothing) です。

Web パーツ コントロール セットのアーキテクチャでは、コントロールが Web パーツ機能を持つことができるのは、それが WebPartZoneBase ゾーンの内部で操作される場合だけです。Web ページで使用する標準の WebPartZoneBase ゾーンは、WebPartZone コントロールです。エンド ユーザーは、Web ページの異なるゾーン間で Web パーツ コントロールを移動できますが、コントロールの特定のインスタンスは、一度に 1 つのゾーンだけに配置できます。Web パーツ コントロール、およびそれに関連付けられている WebPartManager コントロールは、Zone プロパティを使用して、コントロールが現在配置されているゾーンと、格納されているすべての Web パーツ コントロールに適用されているゾーンの共通レイアウトおよびスタイル特性を追跡します。

カスタム Web パーツ コントロールの Zone プロパティおよび ZoneIndex プロパティのアクセス方法を次のコード例に示します。この例は、WebPart クラスの概要の「使用例」で作成した TextDisplayWebPart というカスタム コントロールの使用を前提にしています。
コード例には、ユーザーが Web パーツ ページ上の表示モードを変更できるようにするカスタム ユーザー コントロールが含まれます。ユーザー コントロールは、それをホストする Web ページの先頭付近にある Register ディレクティブを使用して参照されます。このユーザー コントロールを作成して表示モードを操作する方法の詳細については、「チュートリアル : カスタム サーバー コントロールの開発と使用」を参照してください。
<%@ 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 ページです。ページには 2 つの <asp:webpartzone> 要素があり、それぞれが Web パーツ ゾーンを表しています。1 番目のゾーンには、標準の Calendar コントロールが含まれています。これは、ゾーン内にあるので、実行時に WebPart コントロールとして機能します。2 番目のゾーンには TextDisplayWebPart コントロールが含まれています。ユーザーが [Zone Information] ボタンをクリックすると、Label1 コントロールは、コントロールの ZoneIndex プロパティの値と、現在そのコントロールを含んでいるゾーンの ID プロパティの値を表示します。
<%@ page language="VB" %> <%@ register TagPrefix="uc1" TagName="DisplayModeMenuVB" Src="DisplayModeMenuVB.ascx" %> <%@ register tagprefix="aspSample" Namespace="Samples.AspNet.VB.Controls" Assembly="TextDisplayWebPartVB"%> <script runat="server"> Dim labelText As String = _ "<p><strong>Text WebPart " _ + "Zone Information</strong></p>" Sub Button1_Click(ByVal sender As Object, _ ByVal e As EventArgs) ' Get the zone for the Web Parts control. Dim theZone As WebPartZoneBase = textpart1.Zone Label1.Text = labelText + "Zone ID: " _ + theZone.ID + "<br />" _ + "Zone Index: " _ + textpart1.ZoneIndex.ToString() ' Change the type of button for the verb. theZone.VerbButtonType = ButtonType.Button End Sub </script> <html> <head id="Head1" runat="server"> </head> <body> <form id="Form1" runat="server"> <asp:webpartmanager id="WebPartManager1" runat="server" /> <uc1:DisplayModeMenuVB ID="DisplayModeMenu1" runat="server" /> <asp:webpartzone id="WebPartZone1" runat="server" title="Zone 1" PartChromeType="TitleAndBorder"> <parttitlestyle font-bold="true" ForeColor="#3300cc" /> <partstyle borderwidth="1px" borderstyle="Solid" bordercolor="#81AAF2" /> <zonetemplate> <asp:Calendar ID="cal1" Runat="server" /> </zonetemplate> </asp:webpartzone> <asp:webpartzone id="WebPartZone2" runat="server" title="Zone 2" PartChromeType="TitleAndBorder"> <parttitlestyle font-bold="true" ForeColor="#3300cc" /> <partstyle borderwidth="1px" borderstyle="Solid" bordercolor="#81AAF2" /> <zonetemplate> <aspSample:textdisplaywebpart id="textpart1" runat="server" Title="Text WebPart" /> </zonetemplate> </asp:webpartzone> <asp:Button ID="Button1" Runat="server" Text="Zone Information" OnClick="Button1_Click" /> <br /> <asp:Label ID="Label1" runat="server" /> </form> </body> </html>
<%@ page language="C#" %> <%@ register TagPrefix="uc1" TagName="DisplayModeMenuCS" Src="DisplayModeMenuCS.ascx" %> <%@ register tagprefix="aspSample" Namespace="Samples.AspNet.CS.Controls" Assembly="TextDisplayWebPartCS"%> <script runat="server"> String labelText = @"<p><strong>Text WebPart " + "Zone Information</strong></p>"; void Button1_Click(object sender, EventArgs e) { // Get the zone for the Web Parts control. WebPartZoneBase theZone = textpart1.Zone; Label1.Text = labelText + "Zone ID: " + theZone.ID + @"<br />" + "Zone Index: " + textpart1.ZoneIndex.ToString(); // Change the type of button for the verb. theZone.VerbButtonType = ButtonType.Button; } </script> <html> <head id="Head1" runat="server"> </head> <body> <form id="Form1" runat="server"> <asp:webpartmanager id="WebPartManager1" runat="server" /> <uc1:DisplayModeMenuCS ID="DisplayModeMenu1" runat="server" /> <asp:webpartzone id="WebPartZone1" runat="server" title="Zone 1" PartChromeType="TitleAndBorder"> <parttitlestyle font-bold="true" ForeColor="#3300cc" /> <partstyle borderwidth="1px" borderstyle="Solid" bordercolor="#81AAF2" /> <zonetemplate> <asp:Calendar ID="cal1" Runat="server" /> </zonetemplate> </asp:webpartzone> <asp:webpartzone id="WebPartZone2" runat="server" title="Zone 2" PartChromeType="TitleAndBorder"> <parttitlestyle font-bold="true" ForeColor="#3300cc" /> <partstyle borderwidth="1px" borderstyle="Solid" bordercolor="#81AAF2" /> <zonetemplate> <aspSample:textdisplaywebpart id="textpart1" runat="server" Title="Text WebPart" /> </zonetemplate> </asp:webpartzone> <asp:Button ID="Button1" Runat="server" Text="Zone Information" OnClick="Button1_Click" /> <br /> <asp:Label ID="Label1" runat="server" /> </form> </body> </html>

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 によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


WebPartZone イベント

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

関連項目
WebPartZone クラスSystem.Web.UI.WebControls.WebParts 名前空間
WebZone
その他の技術情報
Web パーツ コントロール セットの概要ASP.NET Web パーツの概要
ASP.NET Web パーツ ページ
WebPartZone クラス
アセンブリ: System.Web (system.web.dll 内)


Web パーツ機能において、ゾーンとは Web パーツ コントロールを格納した Web ページ上の定義領域です。ゾーンの主な機能は、ゾーンに含まれるコントロールをレイアウトし、それらのコントロールに共通なユーザー インターフェイス (UI: User Interface) を提供することです。ゾーンに関する一般情報および Web パーツ アプリケーションにおける使用方法については、基本 WebZone クラスおよび WebPartZoneBase クラスの参照ドキュメントと、「Web パーツ コントロール セットの概要」のトピックを参照してください。
WebPartZone コントロールの特別な機能は、Web パーツ アプリケーションの主要な UI を構成する WebPart コントロールを格納することです。WebPartZone コントロールは、Web ページ上で永続化形式で宣言できます。これによって、開発者はこのコントロールをテンプレートとして使用し、<asp:webpartzone> 要素内の他のサーバー コントロールに追加できます。いずれの型のサーバー コントロールも、WebPartZone ゾーンに追加されると、実行時に WebPart コントロールとして機能します。これは、追加されたコントロールが WebPart コントロール、ユーザー コントロール、カスタム コントロール、または ASP.NET コントロールのいずれの場合でも同様です。詳細については、GenericWebPart クラスのトピックを参照してください。
WebPart コントロールが含まれる以外に、WebPartZone コントロールには、このコントロールに含まれるコントロールの UI も用意されています。この共通 UI はまとめてクロムと呼ばれており、すべてのコントロールにおいて、境界線、タイトル、ヘッダーとフッター、スタイル特性、動詞 (ユーザーがコントロールで実行できる、クローズや最小化などの UI 関連処理) などの周辺 UI 要素で構成されます。
WebPartZone クラスのほとんどの動作は、基本 WebZone クラスおよび基本 WebPartZoneBase クラスから派生していますが、ただ 1 つ独自のメンバとして ZoneTemplate プロパティが追加されています。このプロパティは、ITemplate オブジェクトを参照します。このオブジェクトは、ページの開発者が .aspx ページの宣言型マークアップの <zonetemplate> 要素を使用して、コントロールをゾーン内に静的に定義できるテンプレートです。
ユーザー補助このコントロールに既定でレンダリングされるマークアップは、Web Content Accessibility Guidelines (WCAG) 1.0 の優先度 1 ガイドラインなどのユーザー補助に関する標準に適合しない可能性があります。このコントロールのユーザー補助サポートの詳細については、「ASP.NET コントロールとユーザー補助」を参照してください。

Web パーツ ページの WebPartZone コントロールを使用する方法を次のコード例に示します。コード例を実行するためには、このソース コードをコンパイルする必要があります。それを明示的にコンパイルし、コンパイル済みのアセンブリを Web サイトの Bin フォルダまたはグローバル アセンブリ キャッシュに配置できます。サイトの App_Code フォルダにソース コードを配置し、実行時に動的にコンパイルすることもできます。両方のコンパイル方法を示すチュートリアルについては、「チュートリアル : カスタム サーバー コントロールの開発と使用」を参照してください。
コード例の最初の部分では、WebPartZone クラスから継承し、コンストラクタの 2 つの基本ゾーン プロパティを設定するカスタム クラスを示しています。
Imports System.Web.UI.WebControls.WebParts Imports System.Web.UI.WebControls Imports System.Web.UI Imports System.Web Imports System.Security.Permissions Imports System.ComponentModel Imports System.Collections Imports System Namespace Samples.AspNet.VB.Controls <AspNetHostingPermission(SecurityAction.Demand, _ Level := AspNetHostingPermissionLevel.Minimal)> _ <AspNetHostingPermission(SecurityAction.InheritanceDemand, _ Level := AspNetHostingPermissionLevel.Minimal)> _ Public Class MyWebPartZone Inherits WebPartZone Public Sub New() MyBase.New MyBase.VerbButtonType = ButtonType.Button MyBase.CloseVerb.Enabled = false End Sub End Class End Namespace
using System; using System.Collections; using System.ComponentModel; 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 MyWebPartZone : WebPartZone { public MyWebPartZone() { base.VerbButtonType = ButtonType.Button; base.CloseVerb.Enabled = false; } } }
コード例の 2 番目の部分では、カスタムの WebPartZone コントロールを含んだページを示しています。このページには、ページの上部に、カスタム ゾーンが格納されているアセンブリを参照する特殊な Register ディレクティブが必要です。このページには、すべての Web パーツ ページで必要とされる <asp:webpartmanager> 要素も格納されます。カスタムの WebPartZone コントロールを表す <cc1:MyWebPartZone> 要素には、標準 ASP.NET Calendar コントロールが含まれます。このコントロールは WebPartZone ゾーン内に格納されているため、Calendar コントロールは、実行時に WebPart コントロールとして動作できるようにする GenericWebPart コントロールでラップされます。
<%@ Page Language="vb" %> <%@ Register TagPrefix="cc1" Namespace="Samples.AspNet.VB.Controls" Assembly="MyWebPartZoneVB" %> <html > <head runat="server"> <title>Untitled Page</title> </head> <body> <form id="form1" runat="server"> <div> <asp:WebPartManager ID="WebPartManager1" runat="server" /> <cc1:MyWebPartZone ID="MyWebPartZone1" runat="server"> <VerbStyle Font-Italic="true" /> <PartChromeStyle BackColor="lightblue" /> <PartStyle BackColor="gray" /> <PartTitleStyle Font-Bold="true" /> <ZoneTemplate> <asp:Calendar ID="Calendar1" runat="server" Title="My Calendar" /> </ZoneTemplate> </cc1:MyWebPartZone> </div> </form> </body> </html>
<%@ Page Language="C#" %> <%@ Register TagPrefix="cc1" Namespace="Samples.AspNet.CS.Controls" Assembly="MyWebPartZoneCS" %> <html > <head runat="server"> <title>Untitled Page</title> </head> <body> <form id="form1" runat="server"> <div> <asp:WebPartManager ID="WebPartManager1" runat="server" /> <cc1:MyWebPartZone ID="MyWebPartZone1" runat="server"> <VerbStyle Font-Italic="true" /> <PartChromeStyle BackColor="lightblue" /> <PartStyle BackColor="gray" /> <PartTitleStyle Font-Bold="true" /> <ZoneTemplate> <asp:Calendar ID="Calendar1" runat="server" Title="My Calendar" /> </ZoneTemplate> </cc1:MyWebPartZone> </div> </form> </body> </html>
カスタムの WebPartZone コントロールの宣言型マークアップを確認してください。次のコード例に示すように、マークアップにはさまざまなゾーン レベルのプロパティを設定できます。
![]() |
---|
<zonetemplate> 要素は正しい手順で使用してください。「解説」で説明されているように、この要素は、ページで宣言される静的 WebPart コントロールをラップするために WebPartZone ゾーン内に配置する必要があります。 |
<cc1:MyWebPartZone ID="MyWebPartZone1" runat="server"> <VerbStyle Font-Italic="true" /> <PartChromeStyle BackColor="lightblue" /> <PartStyle BackColor="gray" /> <PartTitleStyle Font-Bold="true" /> <ZoneTemplate> <asp:Calendar ID="Calendar1" runat="server" Title="My Calendar" /> </ZoneTemplate> </cc1:MyWebPartZone>
<cc1:MyWebPartZone ID="MyWebPartZone1" runat="server"> <VerbStyle Font-Italic="true" /> <PartChromeStyle BackColor="lightblue" /> <PartStyle BackColor="gray" /> <PartTitleStyle Font-Bold="true" /> <ZoneTemplate> <asp:Calendar ID="Calendar1" runat="server" Title="My Calendar" /> </ZoneTemplate> </cc1:MyWebPartZone>


System.Web.UI.Control
System.Web.UI.WebControls.WebControl
System.Web.UI.WebControls.CompositeControl
System.Web.UI.WebControls.WebParts.WebZone
System.Web.UI.WebControls.WebParts.WebPartZoneBase
System.Web.UI.WebControls.WebParts.WebPartZone


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 によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


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


WebPartZone メソッドは、既定のコンストラクタなので、値は設定できません。ただし、派生クラスでは、このコンストラクタを使用して、基本ゾーン プロパティを設定したり、カスタム ゾーン コントロールの標準の動作や外観を作成したりできます。

カスタム WebPartZone クラスのコンストラクタを使用して、ゾーンのさまざまな基本プロパティを設定する方法を次のコード例に示します。この方法により、特定の動作と外観を持つカスタム WebPartZone コントロールを簡単に作成できます。コントロールをホストするカスタム クラスと .aspx ページを含んだ完全なコード例は、WebPartZone クラスの概要トピックにある「例」のセクションを参照してください。
Imports System.Web.UI.WebControls.WebParts Imports System.Web.UI.WebControls Imports System.Web.UI Imports System.Web Imports System.Security.Permissions Imports System.ComponentModel Imports System.Collections Imports System Namespace Samples.AspNet.VB.Controls <AspNetHostingPermission(SecurityAction.Demand, _ Level := AspNetHostingPermissionLevel.Minimal)> _ <AspNetHostingPermission(SecurityAction.InheritanceDemand, _ Level := AspNetHostingPermissionLevel.Minimal)> _ Public Class MyWebPartZone Inherits WebPartZone Public Sub New() MyBase.New MyBase.VerbButtonType = ButtonType.Button MyBase.CloseVerb.Enabled = false End Sub End Class End Namespace
using System; using System.Collections; using System.ComponentModel; 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 MyWebPartZone : WebPartZone { public MyWebPartZone() { base.VerbButtonType = ButtonType.Button; base.CloseVerb.Enabled = false; } } }

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 によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


WebPartZone プロパティ



関連項目
WebPartZone クラスSystem.Web.UI.WebControls.WebParts 名前空間
WebZone
その他の技術情報
Web パーツ コントロール セットの概要ASP.NET Web パーツの概要
ASP.NET Web パーツ ページ
WebPartZone メソッド



関連項目
WebPartZone クラスSystem.Web.UI.WebControls.WebParts 名前空間
WebZone
その他の技術情報
Web パーツ コントロール セットの概要ASP.NET Web パーツの概要
ASP.NET Web パーツ ページ
WebPartZone メンバ
Web ページ上で、ホストする WebPart コントロールの Web パーツ コントロール セットの主コントロールとして機能します。
WebPartZone データ型で公開されるメンバを以下の表に示します。






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

関連項目
WebPartZone クラスSystem.Web.UI.WebControls.WebParts 名前空間
WebZone
その他の技術情報
Web パーツ コントロール セットの概要ASP.NET Web パーツの概要
ASP.NET Web パーツ ページ
- WebPart.Zoneのページへのリンク