GridControl.RefreshDataSource() Method
Updates the GridControl.MainView to reflect changes made to a data source.
Namespace: DevExpress.XtraGrid
Assembly: DevExpress.XtraGrid.v24.1.dll
NuGet Packages: DevExpress.Win.Grid, DevExpress.Win.Navigation
Declaration
Remarks
Call the RefreshDataSource
method to update data displayed within the grid control’s GridControl.MainView. The method reloads all records from the grid’s associated data source for this purpose. Calling the RefreshDataSource
method makes sense only when the bound data source doesn’t support the IBindingList interface. Otherwise, the grid control will automatically update itself.
The RefreshDataSource
method does not work when the grid control is bound to the IQueryable source.
Important
These automatic updates include information about added and\or removed rows. Changes made to existing rows are not recognized, unless the data source IBindingList object implements the System.ComponentModel.INotifyPropertyChanged interface.
To reload data within detail Views, use the ColumnView.RefreshData method.
Note
Do not call the RefreshDataSource method if you only need to update certain rows, since this method forces the entire grid to re-draw and negatively affects the application performance. In this scenario, utilize the ColumnView.RefreshRow method instead.
Related GitHub Examples
The following code snippets (auto-collected from DevExpress Examples) contain references to the RefreshDataSource() 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.