DataControlRowState Enumeration
Specifies the state of a row in a data control, such as DetailsView or GridView.
This enumeration has a FlagsAttribute attribute that allows a bitwise combination of its member values.
Assembly: System.Web (in System.Web.dll)
| Member name | Description | |
|---|---|---|
| Alternate | Indicates that the data control row is an alternate row. | |
| Edit | Indicates that the row is in an edit state, often the result of clicking an edit button for the row. Typically, the Edit and Insert states are mutually exclusive. | |
| Insert | Indicates that the row is a new row, often the result of clicking an insert button to add a new row. Typically, the Insert and Edit states are mutually exclusive. | |
| Normal | Indicates that the data control row is in a normal state. The Normal state is mutually exclusive with other states except the Alternate state. | |
| Selected | Indicates that the row has been selected by the user. |
The DataControlRowState enumeration identifies the state of a row in a data control such as DetailsView or GridView. A row's state can be one or a combination of the DataControlRowState values, so use bitwise operations to determine whether the state of the row includes a DataControlRowState value, rather than an equivalence test. The DataControlRowState enumeration is used for any type of row, not just DataRow rows (typically, the state of header and footer rows is set to Normal).
You can use the DataControlRowState enumeration to identify the state of a GridViewRow or DetailsViewRow object when enumerating through a GridViewRowCollection or DetailsViewRowCollection collection, respectively. If you are writing a data control that uses rows, you can use the DataControlRowState enumeration to identify when to render different colors for a row (the Alternate value), or controls that are enabled or disabled for editing a row (the Edit and Insert values).
The following code example demonstrates how to use the DataControlRowState enumeration to render a user interface (UI) based on the state of a row in a GridView control. The RadioButtonField class, which is a custom field control that derives from the CheckBoxField control, renders a data-bound radio button for every row in a GridView control. When the row is displaying data to a user, and is not in edit mode, the RadioButton control is disabled. When the user updates a row in GridView and the row is in edit mode, the RadioButton control is rendered as enabled so that it can be clicked. The example uses bitwise AND operators, because the row state might be a combination of one or more DataControlRowState values. This code example is part of a larger example provided for the DataControlField class.
Available since 2.0