GridControl.BeginUpdate() Method

Locks the GridControl object by preventing visual updates of the object and its elements until the EndUpdate method is called.

Namespace: DevExpress.XtraGrid

Assembly: DevExpress.XtraGrid.v20.1.dll

Declaration

public virtual void BeginUpdate()
Public Overridable Sub BeginUpdate

Remarks

You can use the BeginUpdate and GridControl.EndUpdate methods to prevent excessive visual updates to the currently visible Views. After the BeginUpdate method call, the currently opened Views are locked, and do not reflect any appearance changes. The GridControl.EndUpdate method unlocks and redraws the Views.

To prevent excessive updates in a single View, use the BaseView.BeginUpdate and BaseView.EndUpdate methods.

The BeginUpdate and EndUpdate methods do not prevent grid updates caused by data-aware operations (for instance, adding and deleting records, sorting and grouping data). To prevent the grid from being updated in these instances, call the BaseView.BeginDataUpdate and BaseView.EndDataUpdate methods.

NOTE

Do not change the GridControl.MainView property between the GridControl.BeginUpdate and GridControl.EndUpdate method calls. Instead, set the GridControl.MainView property outside the BeginUpdate/EndUpdate block.

Refer to the Batch Modifications Overview topic, for information on batch modifications.

The code sample below illustrates how to pause visual updates in a grid.


gridControl1.BeginUpdate();    // Pause visual updates
foreach (GridColumn column in gridView1.Columns)
{
    if (column.FieldName.Substring(0, 8) == "colPrice")
        column.AppearanceCell.BackColor = Color.Aqua;
}
gridControl1.EndUpdate();      // Unpause visual updates
See Also