ZoneTemplate Property
Collapse the table of content
Expand the table of content

EditorZone.ZoneTemplate Property

Provides a template to contain child controls within an EditorZone control in page persistence format.

Namespace:  System.Web.UI.WebControls.WebParts
Assembly:  System.Web (in System.Web.dll)

public virtual ITemplate ZoneTemplate { get; set; }

Property Value

Type: System.Web.UI.ITemplate
An ITemplate zone template that acts as a container for child controls in the zone.

The ZoneTemplate property is the key difference between the EditorZone class and the base EditorZoneBase class. By adding support for a zone template, the EditorZone class enables page developers to place child EditorPart controls within an EditorZone control in the declarative markup of a Web page. The zone template acts as a container for the child controls.


The set accessor for the ZoneTemplate property calls the InvalidateEditorParts method, which forces the collection of EditorPart controls declared in the template to be recreated. This causes any changes in the contents of the template to be recognized.

To use a zone template declaratively within an EditorZone control, you add a pair of <zonetemplate> tags, and reference EditorPart controls between the tags. Only one zone template is rendered per instance of an EditorZone control (therefore, there is no reason to add multiple <zonetemplate> elements to an EditorZone control). Also, the zone template of an EditorZone control can contain only part controls that derive from the EditorPart class.

The following code example demonstrates declarative use of the ZoneTemplate property. The full code for the example is found in the Example section of the EditorZone class overview.

The code example demonstrates how EditorPart controls can be placed within a <zonetemplate> element in an EditorZone control.

<asp:EditorZone ID="EditorZone1" runat="server" >
  <VerbStyle Font-Italic="true" />
  <EditUIStyle BackColor="lightgray" />
  <PartChromeStyle BorderWidth="1" />
  <LabelStyle Font-Bold="true" />
  <CancelVerb Text="Cancel Changes" />
    <asp:AppearanceEditorPart ID="AppearanceEditorPart1" 
      runat="server" />
    <asp:LayoutEditorPart ID="LayoutEditorPart1" 
      runat="server" />

When you load the page in a browser, you can select Edit Mode in the drop-down list to switch to edit mode. To display the editing user interface (UI), you can click the verbs menu (the downward arrow) in the title bar of one of the two controls, and click Edit to edit the control. With the editing UI visible, you can see the several EditorPart controls that are declared within the <zonetemplate> element.

.NET Framework

Supported in: 4, 3.5, 3.0, 2.0

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Community Additions

© 2015 Microsoft