Tabular Data Controls

Controls derived from the DataBoundControl class all display their data as a list or table of some form. As Figure 8-1 demonstrates, two additional abstract classes then further divide this set of controls by implementation. Controls derived from CompositeDataBoundControl present either individual records or whole tables of data. The composite moniker indicates that these controls contain their own collection of controls to present this data. Meanwhile, controls derived from ListControl present lists of data from which one or more items can be selected.

Tables Table 8-2, Table 8-3, and Table 8-4 list the controls used for presenting individual records, lists, and tables of data, respectively, that can use a DataSource control.

Table 8-2. Server controls for displaying individual records

Control name

Read/write?

Notes

DetailsView, FormView

Read, add, update, delete

DetailsView uses DataRow controls to which to bind fields in the record. FormView allows you to define a template for the record using any server controls you want.

Those list controls deriving from the ListControl class (i.e., those in Table 8-3 with the exception of the ReorderList) bind to the data source control in the same way—using the control’s DataTextField property to specify the data table column name containing the text for each item in the list, and the DataValueField property to specify the column containing the value to be taken from the list if that item were selected.

Table 8-3. Server controls ...

Get Programming ASP.NET 3.5, 4th 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.