What Is a Template?

Essentially, a template is a repeating or non-repeating set of HTML elements or .NET controls mixed with data that make up part of the layout of a web form or user control. Whereas styles affect the appearance of elements, templates create a pattern of elements that makes up a layout. Of course, you can use styles with templates (as we will demonstrate) to affect the look of the elements that are rendered when you're using templates.

As stated, there are currently three intrinsic .NET server controls support templates: DataGrid, DataList, and Repeater.

Beyond using the intrinsic .NET server controls, you can develop your own server controls to support templates. In our next book, Developing Server Controls for ASP.NET, we ...

Get Programming Data-Driven Web Applications with ASP.NET now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.