O'Reilly logo

Programming ASP.NET, Second Edition by Dan Hurwitz, Jesse Liberty

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Tables

Tables are very important in web page design, as they are one of the primary means of controlling the layout on the page. In pure HTML, there are several tags for creating and formatting tables, and many of those have analogs in ASP controls. If you don’t need server-side capabilities, then you are just as well off using the static HTML tags. But when you need to control the table at runtime, then ASP controls are the way to go. (You could also use HTML Server controls, described earlier in this chapter, but they don’t offer the consistency of implementation and object model that ASP controls offer.)

Table 5-10 summarizes the ASP controls used to create tables in web pages.

Table 5-10. ASP controls used to create tables in web pages

ASP control

HTML analog

Description

Table

<table>

Parent control for TableRow controls. The Rows property of the Table object is a collection of TableRow objects.

TableRow

<tr>

Parent control for TableCell controls. The Cells property of the TableRow object contains a collection of TableCell objects.

TableCell

<td>

Contains content to be displayed. The Text property contains HTML text. The Controls collection can contain other controls.

TableHeaderCell

<th>

Derived from the TableCell class. Controls the display of heading cell(s).

There is some overlap in the functionality of Table controls and the DataList controls, such as the Repeater, DataList, and DataGrid, covered in detail in Chapter 9. All can be used to display ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required