
674
|
Chapter 36: The System.Web.UI Namespace
This is the Title of the Book, eMatter Edition
Copyright © 2008 O’Reilly & Associates, Inc. All rights reserved.
Hierarchy
System.Object ➝ ControlBuilder ➝ TemplateBuilder(ITemplate)
Subclasses
RootBuilder, System.Web.UI.MobileControls.DeviceSpecificChoiceTemplateBuilder
TemplateContainerAttribute
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 ITem-
plate 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 prop-
erty 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 ))].
Hierarchy
System.Object ➝ System.Attribute ➝ TemplateContainerAttribute
Valid On
Property
TemplateControl
System.Web.UI ...