GridView: Total Records Count

Discussion in 'ASP .Net Web Controls' started by Amelyan, Mar 30, 2006.

  1. Amelyan

    Amelyan Guest

    I need to get the total number of items/records returned into GridView.

    If I just do myGridView.Rows.Count, then it just returns me the total number
    of items on the page.

    But if I have, 10 pages (10 records per page) and 98 records total,
    Rows.Count will return me 10 on the first 9 pages, and 8, on the last page.

    But, I need to somehow get access to total record count which is 98. What
    is the proper/easy way to accomplish that?

    Thanks,
     
    Amelyan, Mar 30, 2006
    #1
    1. Advertisements

  2. Guest

    The easy way is to return the count as an extra column in your data
    source.
    Like you I'm also waiting to hear the proper way.

    Regards.
     
    , Mar 30, 2006
    #2
    1. Advertisements

  3. I'd suggest you get the row count from the underlying data source. Perhaps
    you're using a DataSet? If so, you'd check MyDataSet.Tables[0].Rows.Count

    --
    I hope this helps,
    Steve C. Orr, MCSD, MVP
    http://SteveOrr.net


    "Amelyan" <bamelyan at wi.rr.com> wrote in message
    news:%...
    >I need to get the total number of items/records returned into GridView.
    >
    > If I just do myGridView.Rows.Count, then it just returns me the total
    > number of items on the page.
    >
    > But if I have, 10 pages (10 records per page) and 98 records total,
    > Rows.Count will return me 10 on the first 9 pages, and 8, on the last
    > page.
    >
    > But, I need to somehow get access to total record count which is 98. What
    > is the proper/easy way to accomplish that?
    >
    > Thanks,
    >
    >
    >
    >
     
    Steve C. Orr [MVP, MCSD], Mar 31, 2006
    #3
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. anand
    Replies:
    4
    Views:
    2,326
    anand
    Jun 17, 2004
  2. Quentin Huo
    Replies:
    5
    Views:
    642
    =?Utf-8?B?TWF0dCBIYW1pbHRvbg==?=
    Sep 1, 2004
  3. Sachin
    Replies:
    2
    Views:
    3,710
    =?Utf-8?B?UyBQ?=
    Mar 5, 2006
  4. Amelyan

    GridView: Total Records

    Amelyan, Mar 30, 2006, in forum: ASP .Net
    Replies:
    9
    Views:
    84,088
    AngelaG
    Oct 24, 2011
  5. Replies:
    2
    Views:
    7,537
    Bruno Alexandre
    Aug 23, 2006
Loading...

Share This Page