count number of rows after GridViewFilteredEvent

6 posts, 0 answers
  1. guy
    guy avatar
    46 posts
    Member since:
    Sep 2010

    Posted 21 Sep 2011 Link to this post

    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?
  2. Vanya Pavlova
    Admin
    Vanya Pavlova avatar
    2019 posts

    Posted 21 Sep 2011 Link to this post

    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 >>

  3. Eric
    Eric avatar
    32 posts
    Member since:
    Jun 2011

    Posted 03 Nov 2011 Link to this post

    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.
  4. Eric
    Eric avatar
    32 posts
    Member since:
    Jun 2011

    Posted 03 Nov 2011 Link to this post

    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.
  5. Vlad
    Admin
    Vlad avatar
    11100 posts

    Posted 03 Nov 2011 Link to this post

    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 >>

  6. Eric
    Eric avatar
    32 posts
    Member since:
    Jun 2011

    Posted 03 Nov 2011 Link to this post

    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.
Back to Top