Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
TemplateInstance Enumeration
Collapse the table of content
Expand the table of content

TemplateInstance Enumeration

Specifies how many times an instance of a template can be created.

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

public enum class TemplateInstance

Member nameDescription
MultipleA template that is instantiated multiple times.
SingleA template that is instantiated only one time.

The TemplateInstance enumeration specifies values indicating the number of times an instance of a template can be created. The TemplateInstanceAttribute class uses values from the TemplateInstance enumeration. In particular, the Single and Multiple fields specify single and multiple instances of a template, respectively. A single instance of a template allows you to reference controls that are contained within the template.

Examples of controls that use the Single value in property metadata include the ZoneTemplate property of the CatalogZone control, the ZoneTemplate property of the EditorZone control, and the ZoneTemplate property of the WebPartZone.

The following code example demonstrates how to use the TemplateInstance enumeration and the TemplateInstanceAttribute class. A custom LoginView control, named MyLoginView, overrides the AnonymousTemplate property and uses the TemplateInstanceAttribute class to specify that only one instance of the AnonymousTemplate property is created.

No code example is currently available or this language may not be supported.

The following code example is an ASPX file that uses the MyLoginView control and demonstrates how to access a Label control that is inside the AnonymousTemplate property.

No code example is currently available or this language may not be supported.

Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98

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

.NET Framework

Supported in: 3.5, 3.0, 2.0

Community Additions

© 2015 Microsoft