The requested page is not available for the requested platform. You are viewing the content for Default platform.

GridColumnDataEventArgs.RowData Property

Gets an object that contains information on the currently processed row.

Namespace: DevExpress.Mobile.DataGrid

Assembly: DevExpress.Mobile.Grid.v18.2.dll

Declaration

public IRowData RowData { get; }
Public ReadOnly Property RowData As IRowData

Property Value

Type Description
IRowData

An object implementing the IRowData interface.

Remarks

Important

This documentation topic describes legacy technology. We no longer develop new functionality for the GridControl and suggest that you use the new DataGridView control instead.

Use the IRowData object's properties and methods to access required data values of the processed row when handling the GridControl.CustomUnboundColumnData event to supply data for an unbound column. The IRowData.RowHandle property returns the processed row handle. To obtain an object representing a record in the grid's underlying data source, use the IRowData.DataObject property. To get a value in the specified field, use the IRowData.GetFieldValue method.

If the GridControl.CustomUnboundColumnData event is raised when an unbound column's value is modified in the grid (GridColumnDataEventArgs.IsSetData is true), you can change any field's value based on the modified value of the unbound column using the IEditableRowData.SetFieldValue method of an object returned by the GridColumnDataEventArgs.EditableRowData property.

Examples

Assume that the GridControl instance is bound to a collection of orders. Each order has the "Product", "UnitPrice"and "Quantity" fields. The example below shows how to add an unbound column to the grid to display the amount of each order according to the expression: UnitPrice*Quantity.

The result is displayed below:

GridControl_CustomUnboundColumnData

// Returns the total for a specific row.
decimal getTotalValue(GridControl grid, int rowHandle) {
    decimal unitPrice = Convert.ToDecimal(grid.GetCellValue(rowHandle, "Product.UnitPrice"));
    decimal quantity = Convert.ToDecimal(grid.GetCellValue(rowHandle, "Quantity"));
    return unitPrice * quantity;
}

// Provides data for the Total column.
void OnCustomUnboundColumnData(object sender, GridColumnDataEventArgs e) {
    if (e.Column.FieldName == "Total" && e.IsGetData)
        e.Value = getTotalValue (e.Source, e.RowData.RowHandle);
}

// Customizes the appearance settings.
void OnCustomizeCell(CustomizeCellEventArgs e) {
if (e.FieldName == "Total") {
        e.BackgroundColor = Color.FromRgb(247, 240, 213);
        e.Handled = true;
    }
}
See Also