WebPartZone WebPartZone WebPartZone Constructor


Initializes a new instance of the WebPartZone class.

public WebPartZone ();
Public Sub New ()


The following code example demonstrates the use of a constructor on a custom WebPartZone class to set several base properties for the zone. This approach could be useful if you want to create a custom WebPartZone control that has specific behaviors and appearance. The full code for the example, including both the custom class and an .aspx page to host the control, is found in the Example section of the WebPartZone class overview topic.

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
  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
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.VerbButtonType = ButtonType.Button
    MyBase.CloseVerb.Enabled = false
  End Sub
End Class
End Namespace


The WebPartZone method is a default constructor and does not set any values. However, derived classes can use the constructor to set base zone properties, to create standard behaviors and appearance for a custom zone control.

Applies to

See also