windowsforms-devexpress-dot-xtragrid-dot-views-dot-base-dot-columnview-95cfec16.md
Enables visual and internal data updates after the ColumnView.BeginSort method call, and forces an immediate View update.
Namespace : DevExpress.XtraGrid.Views.Base
Assembly : DevExpress.XtraGrid.v25.2.dll
NuGet Packages : DevExpress.Win.Grid, DevExpress.Win.Navigation
public void EndSort()
Public Sub
This method is equivalent to the BaseView.EndDataUpdate method. See the ColumnView.BeginDataUpdate topic to learn more.
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(); }
}
Private Sub UpdatePrice(ByVal View As DevExpress.XtraGrid.Views.Base.ColumnView)
' Obtain the Price column.
Dim Col As DevExpress.XtraGrid.Columns.GridColumn = View.Columns.ColumnByFieldName("Price")
If Col Is Nothing Then Exit Sub
View.BeginSort()
Try
' Obtain the number of data rows.
Dim DataRowCount As Integer = View.DataRowCount
' Traverse data rows and change the Price field values.
Dim I As Integer
For I = 0 To DataRowCount - 1
Dim CellValue As Object = View.GetRowCellValue(I, Col)
Dim NewValue As Double = Convert.ToDouble(CellValue) * 0.9
View.SetRowCellValue(I, Col, NewValue)
Next
Finally
View.EndSort()
End Try
End Sub
See Also