How to: Create ASP.NET Web Server Control Templates
Controls such as the DataList, GridView, FormView, and Repeater Web server controls allow you to specify templates, which are HTML elements that define the layout for a particular portion of the control. For example, in the GridView control, you can define templates for items, selected items, alternating items, and so on, so that each of these elements can have a custom look.
To create a Web server control template
In the .aspx file, insert an element inside the control to identify what template you are creating, as in the following example:
Inside the template element, add HTML text and other controls as the template's content. Include property and data-binding values for the embedded controls using normal syntax, as in the following example:
Repeat Steps 1 and 2 for each template you want to create.