This documentation is archived and is not being maintained.

TemplateInstanceAttribute Class

Defines a metadata attribute that is used to specify the number of allowed instances of a template. This class cannot be inherited.

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

public final class TemplateInstanceAttribute extends Attribute

The TemplateInstanceAttribute class allows you to mark a template property as one that allows single or multiple instantiations. A template that only allows a single instantiation can have the controls that are contained inside of it referenced. The ZoneTemplate property is an example of a property that can be instantiated only one time.

This TemplateInstanceAttribute class is optional. If a template property is not extended with a TemplateInstanceAttribute class, the default value, the Multiple field, is used. For more information about using attributes, see Extending Metadata Using Attributes.

The following code example demonstrates how to use the TemplateInstance enumeration and the TemplateInstanceAttribute class. A custom LoginView control named MyLoginViewA 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 MyLoginViewA control and demonstrates how to access properties of the TemplateInstanceAttribute class.

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

System.Object
  System.Attribute
    System.Web.UI.TemplateInstanceAttribute

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

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
Show: