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

count number of rows after GridViewFilteredEvent

5 Answers 145 Views
GridView
This is a migrated thread and some comments may be shown as answers.
guy
Top achievements
Rank 1
guy asked on 21 Sep 2011, 12:50 PM
hi
im tring to recieve number of rows after filtering
i found this example : http://www.telerik.com/help/silverlight/gridview-filtered-event.html
 but i don't have the Records property on my RedGridView element

how can i receive number of rows?

5 Answers, 1 is accepted

Sort by
0
Vanya Pavlova
Telerik team
answered on 21 Sep 2011, 01:21 PM
Hello Guy,

 

Indeed this article is a bit out-dated. You should use RadGridView's Items property instead of Records within RadGridView's Filtered event handler:

MessageBox.Show(RadGridView1.Items.Count.ToString());

Please excuse us for any inconvenience caused! 



All the best,
Vanya Pavlova
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Eric
Top achievements
Rank 1
answered on 03 Nov 2011, 03:21 PM
I found another issue (at least using the Q3 2010 controls). Using grid.Items.Count.ToString() will only give you a maximum of the page size -- not the entire amount of records.
0
Eric
Top achievements
Rank 1
answered on 03 Nov 2011, 03:21 PM
I found another issue (at least using the Q3 2010 controls). Using grid.Items.Count.ToString() will only give you a maximum of the page size -- not the entire amount of records.
0
Vlad
Telerik team
answered on 03 Nov 2011, 03:44 PM
Hi,

 You can use TotalItemCount to get all items count. 

Regards,
Vlad
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Eric
Top achievements
Rank 1
answered on 03 Nov 2011, 03:53 PM
Sorry for my brevity -- I didn't discuss my issue well enough.

Say you have a collection that spans 10 pages of 50 records each (500 total).

You filter it down, leaving you with 140 records (3 pages of 50). When you call grid.Items.Count.ToString() it will only return the number 50 -- the maximum size of the page. However, that value is wrong as you have 150 filtered records in total. How can I get this value of 140?

At first I was thinking of just multiplying by the number of pages, but in the case above I could still get a wrong number.

Edit: I figured it out. The (seemingly, I didn't count by hand) correct call to get the count of rows after a filter is

RadGridView1.Items.ItemCount

Using Items.Count will only retrieve at maximum the page size number, which is incorrect.
Tags
GridView
Asked by
guy
Top achievements
Rank 1
Answers by
Vanya Pavlova
Telerik team
Eric
Top achievements
Rank 1
Vlad
Telerik team
Share this question
or