How to get RadGridView items using paging in telerik?

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 .

2

1 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(); 

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

You Might Also Like