DetailsView Control: Examining One Record at a Time

Another way to look at your data is one record at a time. ASP.NET offers a control explicitly for this purpose: the DetailsView. This control allows you to edit, delete, and insert records.

The DetailsView control is derived from the BaseDataBoundControl class as is the GridView. As such it shares many of the same properties with GridView. Many of the commonly used properties of the DetailsView control that are not inherited from Control or WebControl are listed in Table 9-8.

Table 9-8. DetailsView properties not inherited from WebControl

Property

Type

Get

Set

Values

Description

AllowPaging

Boolean

x

x

true, false

Specifies if paging is enabled. Default is false.

Alternating-RowStyle

TableItemStyle

x

  

Derived from the WebControls.Style class, the style properties for the alternate rows.

AutoGenerate-DeleteButton

Boolean

x

x

true, false

If true, a Delete button will be automatically added to each data row. The default is false.

AutoGenerate-EditButton

Boolean

x

x

true, false

If true, an Edit button will be automatically added to each data row. The default is false.

AutoGenerate-InsertButton

Boolean

x

x

true, false

If true, an Insert button will be automatically added to each data row. The default is false.

AutoGenerateRows

Boolean

x

x

true, false

If true, the default, automatically generated data-bound fields will be displayed.

BottomPagerRow

GridViewRow

x

  

Returns ...

Get Programming ASP.NET, 3rd 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.