Skip to main content
Tab

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.2.dll

NuGet Package: DevExpress.Web

Declaration

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

Parameters

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.

Returns

Type Description
Object

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).

Remarks

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 topic for more information about general aspects of ASPxGridView Row Cache operation.

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];

Note

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

The following code snippets (auto-collected from DevExpress Examples) contain references to the GetRowValues(Int32, String[]) method.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

See Also