Creating Templated Controls
A template enables you to customize the layout of a control. Furthermore, a template can contain expressions that are not evaluated until runtime. The ASP.NET Framework supports two types of templates. First, you can create a one-way databinding template. You use a one-way databinding template to display data items. In a one-way databinding template, you use the Eval() expression to display the value of a data item.
Second, you have the option of creating a two-way databinding template. A two-way databinding template can be used not only to display data items, but also to update data items. You can use the Bind() expression in a two-way databinding template to both display a data item and extract the value of a data item. Typically, you use templates with a databound control. For example, the ListView, GridView, Repeater, DataList, FormView, and DetailsView controls all support an ItemTemplate that enables you to format the data items that these controls display.
Implementing the ITemplate Interface
You create a one-way databinding template by adding a property to a control that returns an object that implements the ITemplate interface. The ITemplate interface includes one method:
InstantiateIn—Instantiates the contents of a template in a particular control.