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




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



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



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



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 ...

Get Programming ASP .NET now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.