Читати англійською Редагувати

Поділитися через


WebPartZone Constructor

Definition

Initializes a new instance of the WebPartZone class.

C#
public WebPartZone();

Examples

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.

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

Remarks

The WebPartZone method is a parameterless 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

Продукт Версії
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1

See also