Skip to main content

ColumnView.SetRowCellValue(Int32, String, Object) Method

Sets the value of the specified cell in the current View.

Namespace: DevExpress.XtraGrid.Views.Base

Assembly: DevExpress.XtraGrid.v22.2.dll

NuGet Package: DevExpress.Win.Grid


public void SetRowCellValue(
    int rowHandle,
    string fieldName,
    object _value


Name Type Description
rowHandle Int32

An integer value representing the handle of the row which contains the desired cell.

fieldName String

A string representing the field name that identifies the required cell.

_value Object

An object representing the value to be assigned.


This method does nothing in the following cases:

  • the specified row handle is invalid or points to a group row;
  • the current View doesn’t contain a column bound to the specified field name;
  • the View’s ColumnView.Columns collection does not contain a GridColumn bound to the specified fieldName.
  • the specified row is a non-initialized New Item Row.

To get a cell’s value, the ColumnView.GetRowCellValue method can be used.

Changing a cell value raises the ColumnView.CellValueChanged event.

For more information on row handles, refer to the Rows document.


Detail pattern Views do not contain data and they are never displayed within XtraGrid. So, the SetRowCellValue member must not be invoked for these Views. The SetRowCellValue member can only be used with Views that display real data within the Grid Control. Use the following methods to access these Views with which an end user interacts at runtime.


The code sample below iterates through grid records and reduces the “Price” column values by 10 percent.

private void UpdatePrice(DevExpress.XtraGrid.Views.Base.ColumnView View) {
   // Obtain the Price column. 
   DevExpress.XtraGrid.Columns.GridColumn col = View.Columns.ColumnByFieldName("Price");
   if (col == null) return;
   try {
      // Obtain the number of data rows. 
      int dataRowCount = View.DataRowCount;
      // Traverse data rows and change the Price field values. 
      for (int i = 0; i < dataRowCount; i++) {
         object cellValue = View.GetRowCellValue(i, col);
         double newValue = Convert.ToDouble(cellValue) * 0.9;
         View.SetRowCellValue(i, col, newValue);
   } finally { View.EndSort(); }
See Also