Export (0) Print
Expand All

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)

[BrowsableAttribute(false)]
[PersistenceModeAttribute(PersistenceMode.InnerProperty)]
[TemplateContainerAttribute(typeof(EditorZone))]
[TemplateInstanceAttribute(TemplateInstance.Single)]
public virtual ITemplate ZoneTemplate { get; set; }
<asp:EditorZone>
	<ZoneTemplate>ITemplate</ZoneTemplate>
</asp:EditorZone>

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.

NoteNote

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" />
  <ZoneTemplate>
    <asp:AppearanceEditorPart ID="AppearanceEditorPart1" 
      runat="server" />
    <asp:LayoutEditorPart ID="LayoutEditorPart1" 
      runat="server" />
  </ZoneTemplate>
</asp:EditorZone>

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.6, 4.5, 4, 3.5, 3.0, 2.0

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

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

Show:
© 2014 Microsoft