Export (0) Print
Expand All

DetailsViewRow Class

Note: This class is new in the .NET Framework version 2.0.

Represents a row within a DetailsView control.

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

public ref class DetailsViewRow : public TableRow
public class DetailsViewRow extends TableRow
public class DetailsViewRow extends TableRow

The DetailsViewRow class is used to represent an individual row in a DetailsView control. Each row in the DetailsView control has a designated row type. The following table lists the row types that are valid for the DetailsView control.

Row type

Description

DataRow

A data row in the DetailsView control.

EmptyDataRow

The empty data row in the DetailsView control. The empty data row is displayed in a DetailsView control when there are no records to display.

Footer

The footer row in the DetailsView control.

Header

The header row in the DetailsView control.

Pager

A pager row in the DetailsView control.

To determine the row type of a DetailsViewRow object, use the RowType property. A DetailsViewRow object also has a state associated with it. The state can be a bitwise combination of the values in the following table.

State value

Description

Alternate

The DetailsViewRow object is an alternate row in the DetailsView control.

Edit

The DetailsViewRow object is in edit mode.

Insert

The DetailsViewRow object is in insert mode.

Normal

The DetailsViewRow object is in its normal (default) state.

To determine the state of a DetailsViewRow object, use the RowState property.

The DetailsView control stores all its data rows in the Rows collection. To determine the index of a DetailsViewRow object in the Rows collection, use the RowIndex property.

You can access the individual cells of the DetailsViewRow object by using the Cells property. If a cell contains controls, you can retrieve a control from the cell by using the Controls collection of the cell. You can also use the FindControl method of the cell to find the control, if the control has an ID property specified.

To retrieve a field value from a BoundField field column or an automatically generated field column, use the Text property of the cell. To retrieve a field value from other field column types where the field value is bound to a control, first retrieve the control from the appropriate cell and then access the appropriate property of the control.

NoteNote

It is possible to use a data-binding expression directly in a TemplateField field column without binding the value to a property of a control. In this case, the field value is automatically placed in a DataBoundLiteralControl control. To retrieve the field value, you must first retrieve the DataBoundLiteralControl control from the appropriate cell and then use its Text property.

For a list of initial property values for an instance of the DetailsViewRow class, see the DetailsViewRow constructor.

The following code example demonstrates how to retrieve the value of a field from a DetailsViewRow object.

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

The following code example demonstrates how to retrieve an Image control from the DetailsViewRow object that represents the header row. The Image control is declared in the header template.

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

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Windows 98, Windows 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0

Community Additions

ADD
Show:
© 2014 Microsoft