Skip to main content

ASPxGridView.GetRowValues(Int32, String[]) Method

Returns the values of the specified data source fields in the specified row.

Namespace: DevExpress.Web

Assembly: DevExpress.Web.v23.1.dll

NuGet Package: DevExpress.Web


public object GetRowValues(
    int visibleIndex,
    params string[] fieldNames


Name Type Description
visibleIndex Int32

Identifies the data row.

fieldNames String[]

An array of the data source field names whose values in the specified row are returned.


Type Description

An array of field values (if several field names are passed via the fieldNames parameter) or a direct field value (if a single field name is passed via the fieldNames parameter).


The GetRowValues method returns the values of the specified data source fields in the specified grid data row.

To work correctly, the GetRowValues method needs the grid to be data bound to its data source. If you call the GetRowValues method in code behind, it returns row values. First, the grid searches for a value in Row Cache. If row data is found, data binding does not occur. If data is not found, the grid is bound with a data source. Refer to the ASPxGridView Row Cache KB article for more information about general aspects of ASPxGridView Row Cache operation (starting from v2011 vol. 2).

The following code snippet illustrates how to get values of several columns simultaneously.

string[] fields = {"FieldName1", "FieldName2", "FieldName3", "FieldName4", "FieldName5"};
object[] values = grid.GetRowValues(3, fields) as object[];
DateTime prog1 = (DateTime)values[4];


If you call the GetRowValues method while an unbound grid control builds its hierarchy (for example, within the HtmlRowCreated, CustomButtonInitialize or ContextMenuItemVisibility event handlers), the GetRowValues method rebinds to data to reset the hierarchy. It might result in displaying the grid with empty data and losing values entered by an end user. To avoid this behavior, call the grid’s ASPxWebControl.DataBind method within the Page_Load event handler.

View Example: How to use the Rich Text Editor to edit formatted text in the Edit Form

See Also