Back to Devexpress

ASPxClientGridView.GetRowValues(visibleIndex, fieldNames, onCallback) Method

aspnet-js-aspxclientgridview-dot-getrowvalues-x28-visibleindex-fieldnames-oncallback-x29.md

latest2.4 KB
Original Source

ASPxClientGridView.GetRowValues(visibleIndex, fieldNames, onCallback) Method

Returns the value(s) of the specified data source field(s) in the specified row.

Declaration

ts
GetRowValues(
    visibleIndex: number,
    fieldNames: string,
    onCallback: ASPxClientGridViewValuesCallback
): void

Parameters

NameTypeDescription
visibleIndexnumber

The data row’s visible index.

| | fieldNames | string |

The names of data source fields whose values are returned, separated by a semicolon.

| | onCallback | ASPxClientGridViewValuesCallback |

A JavaScript function that receives the list of row values as a parameter or a single value if you pass a single field name as a fieldNames parameter.

|

Remarks

Call the GetRowValues method to get data source field values in the row specified by its visible index.

javascript
grid.GetRowValues(grid.GetFocusedRowIndex(), 'EmployeeID;Notes', onCallbackMultiValues);
function onCallbackMultiValues(values) {
    alert(values[0]);
}

If you pass a single field as the fieldNames parameter, the method’s onCallback parameter receives a single value as a parameter.

javascript
grid.GetRowValues(grid.GetFocusedRowIndex(), 'EmployeeID', onCallbackOneValue);
function onCallbackOneValue(value) {
    alert(value);
}

The GetRowValues method uses callback requests and visible indices to get cell values. If a grid’s data source can be changed during a callback, the method may return unexpected data because a row under that visible index is changed. In this case, you can call the GetRowKey(visibleIndex) method to get the row key based on its visible index and the GetRowValuesByKeyValue(Object, String[]) method to obtain the field values based on this key.

Run Demo: ASP.NET Web Forms Grid View - Focused RowRun Demo: ASP.NET MVC Grid View - Focused Row

See Also

ASPxClientGridView Class

ASPxClientGridView Members