0

i used devexpress component

i set data for ItemSource property of GridControl in code behhind like this :

grid.ItemsSource = query ;

query is List

when i filtered or searched in gridcontrol , display rows changed now i want to get the changed itemsource like this :

DataSource = ((IEnumerable)grid.ItemsSource).ToList();

How Can I do it ?

thanks

2 Answers2

0

Try instead of modifying DataSource directly, first bind it to a BindingList (http://msdn.microsoft.com/en-us/library/ms132679%28v=vs.110%29.aspx) and perform filtering on the binding list.

Also, refer to solution to the DataSource updating problem here: Updating of BindingSource in WinForms does not update Datasource Collection

Community
  • 1
  • 1
sonne
  • 377
  • 5
  • 20
0

I Solved this problem by

GridControl.DataController.GetAllFilteredAndSortedRows()