I'm using RadGridView and RadDataPager in my wpf project . The problem that when I have to get all items of GridView it return only items of the current page ( that are only 10 rows ) and it should returns all items that exist in all pages.
Example :
list = Gridview.Items.Cast<User>().ToList(); // Output : I got only 10 elements which are in the first page
My Question is :
How To get all items in GridView ???
NB:
My question is duplicated How to get radlistview items if you use paging , but the OP asked for a solution for Asp.net not for WPF solution.
I have searched for the same property mentioned in the solution , but I didn't find it .
21 Answer
You get them from the RadDataPager itself.
So if you set the ItemsSource of your RadGridView to a RadDataPager like this:
<telerik:RadGridView ItemsSource="{Binding PagedSource, ElementName=radDataPager}" /> <telerik:RadDataPager x:Name="radDataPager" Source="{Binding Items}" PageSize="5" /> You should either get the items from the Source property of the RadDataPager control or from the source property (Items in this case) that is bound to it:
list = radDataPager.Source.OfType<User>().ToList();