GridView.GetRowCellValue(Int32, GridColumn, OperationCompleted) Method

Returns the specified cell's value in Instant Feedback Mode.

Namespace: DevExpress.XtraGrid.Views.Grid

Assembly: DevExpress.XtraGrid.v20.2.dll

Declaration

public virtual object GetRowCellValue(
    int rowHandle,
    GridColumn column,
    OperationCompleted completed
)
Public Overridable Function GetRowCellValue(
    rowHandle As Integer,
    column As GridColumn,
    completed As OperationCompleted
) As Object

Parameters

Name Type Description
rowHandle Int32

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.

column GridColumn

A GridColumn object or descendant specifying the column that contains the desired cell.

completed DevExpress.Data.OperationCompleted

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.

Returns

Type Description
Object

An object that is the specified cell's value.

null (Nothing in Visual Basic) if the specified cell is not found.

In Instant Feedback Mode, an invalid "Non-loaded Value" is immediately returned if the requested cell is not currently loaded.

Remarks

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 column doesn't belong to the View or is a null reference.
NOTE

The following note 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.

private void simpleButton1_Click(object sender, EventArgs e) {
    object val = gridView1.GetRowCellValue(501, gridView1.Columns["Subject"], MyOperationCompleted);
    if(BaseEdit.IsNotLoadedValue(val))
        MessageBox.Show("The row is not loaded");
    else
        MessageBox.Show("The row is loaded. Its value is " + val);
}

void MyOperationCompleted(object arguments) {
    MessageBox.Show("The requested row is now loaded. Its value is " + arguments);
}
NOTE

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.

See Also