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

[Solved] Count of filtered items

6 Answers 211 Views
GridView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Keith
Top achievements
Rank 1
Keith asked on 23 Aug 2010, 01:37 PM
Hi

Unfortunately I'm currently using an old version of the GridView (Q1 2009) and I'm having trouble trying to get the filter count. I bind the ItemsSource to the results of my web service (which returns an ObservableCollection) but when I filter the grid I don't seem able to determine the filtered result count. The Items collection always has a count of 0 and the ItemsSource the length of the collection returned. I've seen in previous forum posts that I should catch the collectionchanged event of the Items property but this doesn't seem relevant as the Items is empty. Am I missing something obvious here please??

Thanks
Keith

6 Answers, 1 is accepted

Sort by
0
Milan
Telerik team
answered on 23 Aug 2010, 01:58 PM
Hi Keith Pilkington,

RadGridView.Items.TotalItemCount will give you the total item count (count before filtering) and RadGridView.Items.Count will give you the number of currently displayed items. TotalItemCount - Count will give you the number of items that are not displayed. 


Greetings,
Milan
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Keith
Top achievements
Rank 1
answered on 24 Aug 2010, 09:03 AM
Hi

Thanks for the reply but I cannot see the property TotalItemCount. Is this available with the version I'm using (Q1 2009)? The Items.Count always seems to be 0 when I bind using the ItemsSource property.

Thanks
Keith
0
Milan
Telerik team
answered on 24 Aug 2010, 09:27 AM
Hi Keith Pilkington,

Sorry for the misunderstanding but the ticket information dictates that you are using 2010.2 812.  Those properties were introduced after Q1 2009. Is it convenient for you to upgrade to our latest version?


Sincerely yours,
Milan
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Ulrich Fiege
Top achievements
Rank 1
answered on 01 Oct 2010, 02:59 PM
>>>
RadGridView.Items.TotalItemCount will give you the total item count (count before filtering) and RadGridView.Items.Count will give you the number of currently displayed items. TotalItemCount - Count will give you the number of items that are not displayed. 

How can i access in this for loop all items?

 

For i As Integer = 0 To grtours.Items.TotalItemCount - 1 <- All Items
  
Dim row As DataItemsQuery = DirectCast(grtours.Items(i), DataItemsQuery) <- Problem index out of bounds
  
Next

Thank you ...
0
Milan
Telerik team
answered on 05 Oct 2010, 03:19 PM

Hello Ulrich Fiege,

If you would like to access all items you need to have access to the original collection that the grid is bound to. For example, you can cast ItemsSource of the grid to your collection type to access all items - unfortunately this approach is not applicable if you are using CollectionView as items source. 

It would be great if you can shame more details about your scenario so that we can provide you with more concrete answer. 



Sincerely yours,
Milan
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Milan
Telerik team
answered on 05 Oct 2010, 03:19 PM

Hello Ulrich Fiege,

If you would like to access all items you need to have access to the original collection that the grid is bound to. For example, you can cast ItemsSource of the grid to your collection type to access all items - unfortunately this approach is not applicable if you are using CollectionView as items source. 

It would be great if you can shame more details about your scenario so that we can provide you with more concrete answer. 



Sincerely yours,
Milan
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
GridView
Asked by
Keith
Top achievements
Rank 1
Answers by
Milan
Telerik team
Keith
Top achievements
Rank 1
Ulrich Fiege
Top achievements
Rank 1
Share this question
or