System.Web.UI (system.web.dll)sealed class

This attribute is used when creating templated controls, which allow the control user to specify a portion of the control's user interface. This functionality is implemented in controls like System.Web.UI.WebControls.Repeater and System.Web.UI.WebControls.DataList, which format bound data according to specified templates. In these controls, and in any custom templated controls you make, the TemplateContainerAttribute is applied to every ITemplate property. The attribute specifies the type of the container control the template will be instantiated in, so that casting is not required to evaluate data binding expressions. For example, the System.Web.UI.WebControls.DataList.ItemTemplate property is a ITemplate property that allows you to set or retrieve the template for items in the list. This particular property has the attribute [TemplateContainer(typeof(System.Web.UI.WebControls.DataListItem ))].

public sealed class TemplateContainerAttribute : Attribute {
// Public Constructors
   public TemplateContainerAttribute(Type containerType);
// Public Instance Properties
   public Type ContainerType{get; }


System.Object System.Attribute TemplateContainerAttribute

Valid On


    Part I: Introduction to ASP.NET
    Part III: Namespace Reference
    Chapter 40. The System.Web.UI.MobileControls Namespace
    Chapter 42. The System.Web.UI.WebControls Namespace