Accessing Rows

  • 2 minutes to read

The ASPxVerticalGrid control stores its rows within the ASPxVerticalGrid.Rows collection. The collection of visible rows can be accessed by the ASPxVerticalGrid.VisibleRows property.

An individual row can be accessed by the VerticalGridRowCollection.Item property by specifying one of the following row characteristics.

NOTE

The following priority applies when you use string row identifiers to search for a row.

  • First, the Name property match is searched for.
  • Then, the first FieldName property match is searched for.
  • Lastly, the first Caption property match is searched for.

Below is an example of how to access rows using different row characteristics.

// Accessing a row by specifying its unique identifier name - a row's Name property is set to 'MyRow1'.
VerticalGridRow colMyRow = ASPxVerticalGrid1.Rows["MyRow1"];

// Accessing a row by specifying the name of the data source field to which it is bound - a row's FieldName property is set to 'Department'.
VerticalGridRow colDepartment = ASPxVerticalGrid1.Rows["Department"];

// Accessing a row by specifying its caption - a row's Caption property is set to 'Primary Phone'.
VerticalGridRow colPhone = ASPxVerticalGrid1.Rows["Primary Phone"];

// Accessing a row by its index within the Rows collection.
VerticalGridRow colFirstRow = ASPxVerticalGrid1.Rows[0];

Client rows can be accessed using the ASPxClientVerticalGrid.GetRow, ASPxClientVerticalGrid.GetRowByField or ASPxClientVerticalGrid.GetRowById method.