GridView.GetRowCellValue(Int32, String, OperationCompleted) Method
Gets the value of the specified cell in the grid's data source.
public virtual object GetRowCellValue( int rowHandle, string fieldName, OperationCompleted completed )
Public Overridable Function GetRowCellValue( rowHandle As Integer, fieldName As String, completed As OperationCompleted ) As Object
An integer value that is the handle of the row in which the desired cell resides. Row handles are not data source indexes, see the Accessing Rows in Code. Row Handles section of the "Rows" article for more information.
A string representing the field name whose value is to be returned. This parameter can refer to any field in the data source, even if the current View does not contain a GridColumn referring to this field.
A DevExpress.Data.OperationCompleted method that will be called when the requested value is ready to be returned. The method's argument will contain the requested value. The completed parameter is optional and is only required in Instant Feedback Mode.
An object that is the specified cell's value.
If the required value is not found in the data source (e.g., if the specified field name does not exist), the method returns null (Nothing in Visual Basic).
In Instant Feedback Mode, an invalid "Non-loaded Value" is immediately returned if the requested cell is not currently loaded.
The method returns null (Nothing in Visual Basic) in the following cases:
- the specified row handle doesn't point to any of the rows within the current View or points to a group row;
- the specified field doesn't exist in the data source.
To get a cell's displayed value, the ColumnView.GetRowCellDisplayText method can be used.
The following applies when Instant Feedback Mode is enabled.
In this mode, data is loaded by the grid control dynamically, in portions. When calling the GetRowCellValue method, the requested cell may not be currently loaded. If the cell is not loaded, the GetRowCellValue method will immediately return a special invalid "Non-loaded Value". You can check whether the returned value is an invalid "Non-loaded Value" via the static BaseEdit.IsNotLoadedValue method. If the value returned is valid, the BaseEdit.IsNotLoadedValue method will return false.
To get a valid cell value, define a method of the DevExpress.Data.OperationCompleted type, and call the GetRowCellValue method, passing your OperationCompleted method as the third parameter. Your OperationCompleted method will be called when the corresponding cell has been loaded. The requested cell value will be stored in the OperationCompleted method's argument.
Detail pattern Views do not contain data and they are never displayed within XtraGrid. So, the GetRowCellValue member must not be invoked for these Views. The GetRowCellValue member can only be used with real Views that are displayed within the Grid Control. The real Views with which an end-user interacts at runtime can be accessed using the following methods.
- GridControl.MainView - returns the top most View in a grid;
- GridControl.FocusedView - returns the focused View;
- GridControl.DefaultView - returns the currently maximized View;
- the sender parameter of View specific events;
- GridView.GetDetailView - returns a detail clone View for a specific master row.