Articles in this section
Category / Section

How do I efficiently directly modify the underlying DataSource when it is bound to the DataBoundGrid?

1 min read


The best way to do this would be calling the grid.BeginUpdate() and grid.Binder.SuspendBinding() before you modify the underlying DataSource and call grid.Binder.ResumeBinding() and grid.EndUpdate() after that.

SuspendBinding and ResumeBinding are two methods that allow the temporary suspension and resumption of data binding. You would typically suspend data binding if you want to make several changes to the data source without immediately updating the grid after each change.

For example, if you want to clear out all records in your data set and refill it with its original data, you can improve performance of this operation substantially if the grid does not need to immediately reflect every row change in the grid while the data set is filled.

BeginUpdate method suspends the painting of associated grid controls until the EndUpdate method is called.

Also call grid.Binder.ResetHierarchyLevels() if you have changed the underlying data source and you had several relations added.

Did you find this information helpful?
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment