System.Web 2.0.0.0 System.Web.UI.ITemplate

The interface provides a way for ASP.NET data-bound controls, such as , , and , to bind to data supplied by an ASP.NET data source control, such as or , when the data-bound control includes templated content.

Page developers do not implement the interface. Developers creating custom data-bound controls might manipulate objects in implementations of the and methods, but do not implement their own objects.

Data-bound controls such as typically are aware of their child control trees, and can therefore bind values to them, extract values from them, and pass these values between the data-bound control and a data source control whenever data binding occurs. However, when a page developer defines templated content for a data-bound control, the child controls within the template are not visible to the parent data-bound control: the parent can render the child content (because controls effectively render themselves), but it cannot extract the values of these child controls to pass to an associated data source control's update, insert, or delete operation. In data-binding scenarios, templated content is opaque to a parent data-bound control. The Bind syntax makes it possible for the data-bound control to extract the values from a control data-bound inside an instance.

The data binding can be one-way or two-way. (These binding directions are defined by the enumeration.) One-way data binding is any data binding performed in an outbound direction, from data source control to data-bound control; for example, any data-reading scenario involves one-way data binding. For one-way data binding, you can use one-way data binding syntax (<%# Eval("fieldname") %>) inside templated content, and do not need to use two-way ASP.NET data-binding syntax. Two-way data-binding describes data-binding in the inbound direction, from the data-bound control to the data source control. Automatic edit, insert, and delete scenarios using ASP.NET data-bound and data source controls are two-way data-binding scenarios. These scenarios use two-way data-binding expressions (<%# Bind("fieldname") %>). The interface and the ASP.NET infrastructure support automatic, declarative, two-way data binding between ASP.NET data source controls and templated content. For more information about ASP.NET data-binding expressions and syntax, see Data Binding and Data-Binding Expression Syntax.

Templated content for data-bound controls is most often defined declaratively. The following table describes the processes most commonly used to bind templated data to data-bound controls.

Data-bound control

Process

The data-bound control is bound to data using the DataSourceID property of the data source control, and the templated content is defined in an , or property.

The data-bound control is bound to data using the DataSourceID property of the data source control, and the templated content is defined in an or property. The control does not support an insert operation.

The data-bound control is bound to data using the DataSourceID property, and the templated content is defined in an , , or property, or in a object.

The and controls do not support automatic two-way data-binding scenarios.

ASP.NET implicitly creates an object when templated content that binds to an ASP.NET data source control within the template is parsed. Specifically, the ASP.NET parser creates an instance of the class when it parses templated content that uses ASP.NET data-binding syntax and contains ASP.NET Web server controls that support data binding. These ASP.NET sever controls are marked by the attribute.

The interface defines one method, . This method is defined for two-way data binding, so that a data-bound control can automatically extract name/value pairs from templated content and pass the pairs to a data source control at run time. For automatic data binding to succeed, the field names extracted from the templated content by the method must match parameter names in an associated data source control. Control developers call the method explicitly only within their implementations of or some other similar method of a custom data-bound control.

Provides a way for ASP.NET data-bound controls, such as and , to automatically bind to an ASP.NET data source control within templated content sections.

- Method
  System.Collections.Specialized.IOrderedDictionary `` To be added. To be added.

  When implemented by a class, retrieves a set of name/value pairs for values bound using two-way ASP.NET data-binding syntax within the templated content.

  An of name/value pairs. The name represents the name of a control within templated content, and the value is the current value of a property value bound using two-way ASP.NET data-binding syntax.

  2.0.0.0