This is a migrated thread and some comments may be shown as answers.

Iterating GridView>items when RadPager is used

4 Answers 62 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Peter
Top achievements
Rank 1
Peter asked on 11 Oct 2012, 05:28 PM
Hi,

I am using RadGridView to select itemsfrom a database to be archived to an external drive, applying complex filters in code-behind, I then need to iterate RadGridView.Items, however because I am also using a RadPager control, I can only access up to a complete page full (in this case 25). How do I iterate all items that are currently available.

Best regards
Peter

4 Answers, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 12 Oct 2012, 05:35 AM
Hi Peter,

 Why not iterate directly the collection bound to the grid/pager?

Regards,
Vlad
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Peter
Top achievements
Rank 1
answered on 12 Oct 2012, 07:15 AM
Hi Vlad,

The bound data table is filtered programatically, it is the filtered results that I want to iterate.

So data tabel contains, say, 2000 records,
Filtering leaves, say, 120 records displayed in RadGridView.
But because of RadDataPager page size (25) can only iterate 25 items in RadGridView.Items

Best regards
Peter
0
Accepted
Vlad
Telerik team
answered on 12 Oct 2012, 07:52 AM
Hello Peter,

 If you bind the grid to a QueryableCollectionView and this view is filtered from the grid filters you can apply the same filters on the view QueryableSourceCollection property to get the filtered items. For example:

var filteredItems = view.QueryableSourceCollection.Where(view.FilterDescriptors);

Kind regards,
Vlad
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Peter
Top achievements
Rank 1
answered on 12 Oct 2012, 11:10 AM
Hi Vlad,

Outstanding solution, works perfectly

Best regards
Peter
Tags
GridView
Asked by
Peter
Top achievements
Rank 1
Answers by
Vlad
Telerik team
Peter
Top achievements
Rank 1
Share this question
or