Displaying Data with the DataList
Control
To display data with the DataList
control, you must supply the control with an ItemTemplate
. The contents of the ItemTemplate
are rendered for each data item from the data source.
For example, the page in Listing 13.6 uses a DataList
to display the contents of the Movies database table. The ItemTemplate
displays the values of the Title, Director, and BoxOfficeTotals columns (see Figure 13.5).
Figure 13.5. Displaying database records with the DataList
control.
Listing 13.6. ShowDataList.aspx
The DataList ...
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.