Skip to main content

ColumnView.BeginSort() Method

Prevents visual and internal data updates until the ColumnView.EndSort method is called.

Namespace: DevExpress.XtraGrid.Views.Base

Assembly: DevExpress.XtraGrid.v24.2.dll

Declaration

public void BeginSort()

Remarks

This method is equivalent to the ColumnView.BeginDataUpdate method. See this topic to learn more.

Example

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;
   View.BeginSort();
   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