Using Templates with the DataList Control

The DataList control supports all the same templates as the Repeater control:

ItemTemplate Formats each item from the data source.

AlternatingItemTemplate Formats every other item from the data source.

SeparatorTemplate Formats between each item from the data source.

HeaderTemplate Formats before all items from the data source.

FooterTemplate Formats after all items from the data source.

In addition, the DataList supports the following templates:

EditItemTemplate Displays when a row is selected for editing.

SelectedItemTemplate Displays when a row is selected.

The DataList control in Listing 13.9 includes both a HeaderTemplate and a FooterTemplate. The HeaderTemplate contains the ...

Get ASP.NET 4 Unleashed 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.