Calculate viewd row number

9 posts, 0 answers
  1. Adiel
    Adiel avatar
    60 posts
    Member since:
    Jun 2012

    Posted 08 Jun 2009 Link to this post

    Hi
    I want to show GridView with paging.
    I need to calculate page size by the actual viewed rows.
    Is there is a way to know that?
    I don't want scrolls and in every resolution there is different number of rows...
    Thanks
    Adiel
  2. Vlad
    Admin
    Vlad avatar
    11100 posts

    Posted 08 Jun 2009 Link to this post

    Hello Adiel,

    You can use our extension methods to achieve this:

    var count = RadGridView1.ChildrenOfType<GridViewRow>().Count;

    Best wishes,
    Vlad
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  3. DevCraft banner
  4. Adiel
    Adiel avatar
    60 posts
    Member since:
    Jun 2012

    Posted 08 Jun 2009 Link to this post

    Hi
    Great extensions!
    Anyway In this way I had to try large amount of rows and then reduce page size.
    I'm looking for way to calculate it from beginning. (base on Actual height?)
    Any ideas?
    Thanks
    Adiel
  5. Hristo
    Admin
    Hristo avatar
    832 posts

    Posted 08 Jun 2009 Link to this post

    Hello Adiel,

    You cannot know the ActualHeight before the row is loaded. The only way to know the Height before row loaded is to set RowStyle on RadGridView and the set the Height to some value.

    I hope this helps.

    Regards,
    Hristo
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  6. Marc Roussel
    Marc Roussel avatar
    429 posts
    Member since:
    Dec 2009

    Posted 18 Dec 2009 Link to this post

    Is there something I don't understand here ?
    the count reports me 4 rows but I have only 3 in the gridview !

    If I'm right, is this the same thing as RadGridView.Items.Count ?
  7. Rossen Hristov
    Admin
    Rossen Hristov avatar
    2478 posts

    Posted 18 Dec 2009 Link to this post

    Hello Marc Rousel,

    One of the them is the invisible GridViewNewRow which also inherits from GridViewRow.

    All the best,
    Ross
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  8. Marc Roussel
    Marc Roussel avatar
    429 posts
    Member since:
    Dec 2009

    Posted 18 Dec 2009 Link to this post

    Thank you for the information.
    By the way my name is with 2 s Roussel

    So based on this, when I have to iterate the rows, I should use .Count - 2 to take into account the newrow which I presume
    is the last one !

  9. Rossen Hristov
    Admin
    Rossen Hristov avatar
    2478 posts

    Posted 18 Dec 2009 Link to this post

    Hi Marc Rousel,

    It is better if you check whether the row is GridViewNewRow while iterating and if it is -- then do not do the thing you are doing.

    As for the name, this is the way it is entered in your profile. You can edit your profile if you want to change your name.

    Best wishes,
    Ross
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  10. Marc Roussel
    Marc Roussel avatar
    429 posts
    Member since:
    Dec 2009

    Posted 18 Dec 2009 Link to this post

    Thanx.
Back to Top
DevCraft banner