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

Problem getting filtered items count.

1 Answer 225 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Niklas
Top achievements
Rank 1
Niklas asked on 13 Mar 2015, 10:09 AM
I have a RadGridView that is using filters. And i have a RadDataPager with its source set to the "Items" of the RadGridView. I want to display the total number of filtered items in the grid. What is the best approach to get the number of filtered items? Since i use paging, i cant just count the visible rows in the grid. And i cant use the RadDataPager.PagedSource.ItemCount, since that value is not affected by the filtering. Is there no "FilteredItemsCount" i can use? ;)

1 Answer, 1 is accepted

Sort by
0
Dimitrina
Telerik team
answered on 16 Mar 2015, 09:41 AM
Hi Nikita,

When a pager is used, then only the items displayed on the current page will be available. If you access RadGridView.Items collection, there are all the items just on the current page as RadGridView is not aware there are further pages.


Please note filtering is a data operation which means it is done by building and executing a LINQ query appending proper Where clause over the source collection. 

That is why you can also execute such a query over the source collection directly to get all the filtered items based on the used defined filtering criteria. 
For example:
var listAllFilterItems = source.Where(a => a.Name == "Liverpool");


All the filtering settings are available with each column's ColumnFilterDescriptor. Please check our online documentation where the filtering is explained in details.

Regards,
Dimitrina
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
GridView
Asked by
Niklas
Top achievements
Rank 1
Answers by
Dimitrina
Telerik team
Share this question
or