We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

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

 

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.

Article ID: Published Date: Last Revised Date: Platform: Control:
474 04/30/2011 07/10/2014 Windows Forms GridDataBoundGrid(Classic)
Did you find this information helpful?
Add Comment
You must log in to leave a comment

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.