Skip to main content

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.v24.1.dll

NuGet Packages: DevExpress.Win.Grid, DevExpress.Win.Navigation

Declaration

public virtual void 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

The following code snippets (auto-collected from DevExpress Examples) contain references to the BeginUpdate() method.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

See Also