aspnet-js-aspxclientgridview-dot-getrowvalues-x28-visibleindex-fieldnames-oncallback-x29.md
Returns the value(s) of the specified data source field(s) in the specified row.
GetRowValues(
visibleIndex: number,
fieldNames: string,
onCallback: ASPxClientGridViewValuesCallback
): void
| Name | Type | Description |
|---|---|---|
| visibleIndex | number |
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.
|
Call the GetRowValues method to get data source field values in the row specified by its visible index.
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.
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