DataControlRowType Enumeration
Collapse the table of content
Expand the table of content

DataControlRowType Enumeration

Specifies the function of a row in a data control, such as a DetailsView or GridView control.

Namespace:  System.Web.UI.WebControls
Assembly:  System.Web (in System.Web.dll)

public enum class DataControlRowType

Member nameDescription
DataRowA data row of a data control. Only DataRow rows can be data-bound.
EmptyDataRowThe empty row of a data-bound control. The empty row is displayed when the data-bound control has no records to display and the EmptyDataTemplate template is not nullptr.
FooterA footer row of a data control. Footer rows cannot be data-bound.
HeaderA header row of a data control. Header rows cannot be data-bound.
PagerA row that displays pager buttons or a pager control. Pager rows cannot be data-bound.
SeparatorA row separator. Row separators cannot be data-bound.

The DataControlRowType enumeration identifies the function of rows in a data control. It is used by the DetailsView and GridView controls to distinguish between rows that display data and rows that display other user interface (UI) elements, such as a header row, row separator, or pager buttons.

You can use the DataControlRowType enumeration to identify the type of a GridViewRow or DetailsViewRow object when you enumerate through a GridViewRowCollection or DetailsViewRowCollection collection. If you are writing a data control that creates rows, you can use the DataControlRowType enumeration to identify the function of different rows in the control.

The following code example demonstrates how to use the DataControlRowType enumeration to check the type of a row when working with a GridView control. The AuthorsGridView_RowCreated method ensures that the CommandArgument property of a LinkButton control is unique for all the data rows in the GridView control, so that when a row's LinkButton control is clicked, it can be identified correctly.

No code example is currently available or this language may not be supported.

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0, 2.0
© 2015 Microsoft