TemplateInstanceAttribute Class
Assembly: System.Web (in system.web.dll)
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.
The following code example is an ASPX file that uses the MyLoginViewA control and demonstrates how to access properties of the TemplateInstanceAttribute class.
- AspNetHostingPermission for operating in a hosted environment. Demand value: LinkDemand; Permission value: Minimal.