WebPartZone コンストラクター

定義

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

public:
 WebPartZone();
public WebPartZone ();
Public Sub New ()

次のコード例では、カスタム WebPartZone クラスでコンストラクターを使用して、ゾーンのいくつかの基本プロパティを設定する方法を示します。 この方法は、特定の動作と外観を持つカスタム WebPartZone コントロールを作成する場合に便利です。 コントロールをホストするカスタム クラスと .aspx ページの両方を含む、この例の完全なコードについては、クラスの概要に関するトピックの「例」セクションを WebPartZone 参照してください。

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;
    }
  }
}
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
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

注釈

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

適用対象

こちらもご覧ください