Displaying Content Using Data
Lists
10
Similar to the Repeater control, the DataList control allows you to bind and
customize the presentation of database data. The fundamental difference is that
while the Repeater requires you to build the template from scratch (allowing
you to customize the generated HTML output in any way you like), the DataList
control automatically generates a single-column HTML table for you, like the
one shown below:
<table>
<tr>
<td>
<p>Employee ID: 1</p>
<p>Name: Zak Ruvalcaba</p>
<p>Username: zak</p>
</td>
</tr>
<tr>
<td>
<p>Employee ID: 2</p>
<p>Name: Jessica Ruvalcaba</p>
<p>Username: jessica</p>
</td>
</tr>
<tr>
<td>
<p>Employee ID: 3</p>

Get Build Your Own ASP.NET 2.0 Web Site Using C# & VB, Second Edition 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.