Getting Total Item Count in Paging Datagrid

Discussion in 'ASP .Net Datagrid Control' started by jason smith, Jul 22, 2003.

  1. jason smith

    jason smith Guest

    I'm not sure if I am just missing some obvious function call or what.

    I want to be able to get the overall count of the records returned from
    my database query. When I use datagrid.Item.Count, it only returns the
    count for the current page. I see a property that lists pagecount, but
    nothing for totalcount. I want to have a label above my datagrid that
    says "n results returned".

    Can anyone help, thanks.

    *** Sent via Developersdex http://www.developersdex.com ***
    Don't just participate in USENET...get rewarded for it!
     
    jason smith, Jul 22, 2003
    #1
    1. Advertising

  2. jason smith

    Prasad Guest

    Hi

    Use dataGrid.PageCount * dataGrid.PageSize

    HTH
    Prasad

    "jason smith" <> wrote in message
    news:...
    >
    >
    > I'm not sure if I am just missing some obvious function call or what.
    >
    > I want to be able to get the overall count of the records returned from
    > my database query. When I use datagrid.Item.Count, it only returns the
    > count for the current page. I see a property that lists pagecount, but
    > nothing for totalcount. I want to have a label above my datagrid that
    > says "n results returned".
    >
    > Can anyone help, thanks.
    >
    > *** Sent via Developersdex http://www.developersdex.com ***
    > Don't just participate in USENET...get rewarded for it!
     
    Prasad, Jul 22, 2003
    #2
    1. Advertising

  3. jason smith

    jason smith Guest

    That solution will not give me the exact number. For example if the user
    has paging set to 100 items per page and there are 577 items returned,
    your solution will display 600 items found.

    Is there a way to do (pagecount-1 * numberofpages) + (lastpagecount).


    Thanks,

    *** Sent via Developersdex http://www.developersdex.com ***
    Don't just participate in USENET...get rewarded for it!
     
    jason smith, Jul 22, 2003
    #3
  4. jason smith

    Alvin Bruney Guest

    get it from the underlying datagrid
    datagrid.table[0].rows.count will always be accurate.

    "jason smith" <> wrote in message
    news:...
    >
    >
    > That solution will not give me the exact number. For example if the user
    > has paging set to 100 items per page and there are 577 items returned,
    > your solution will display 600 items found.
    >
    > Is there a way to do (pagecount-1 * numberofpages) + (lastpagecount).
    >
    >
    > Thanks,
    >
    > *** Sent via Developersdex http://www.developersdex.com ***
    > Don't just participate in USENET...get rewarded for it!
     
    Alvin Bruney, Jul 23, 2003
    #4
  5. jason smith

    Alvin Bruney Guest

    sorry i meant dataset. duh...brain fart.

    "Alvin Bruney" <vapordan_spam_me_not@hotmail_no_spamhotmail.com> wrote in
    message news:#...
    > get it from the underlying datagrid
    > datagrid.table[0].rows.count will always be accurate.
    >
    > "jason smith" <> wrote in message
    > news:...
    > >
    > >
    > > That solution will not give me the exact number. For example if the user
    > > has paging set to 100 items per page and there are 577 items returned,
    > > your solution will display 600 items found.
    > >
    > > Is there a way to do (pagecount-1 * numberofpages) + (lastpagecount).
    > >
    > >
    > > Thanks,
    > >
    > > *** Sent via Developersdex http://www.developersdex.com ***
    > > Don't just participate in USENET...get rewarded for it!

    >
    >
     
    Alvin Bruney, Jul 23, 2003
    #5
    1. Advertising

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. DC Gringo

    total record count in datagrid

    DC Gringo, Mar 4, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    5,941
    nfedin
    Mar 4, 2004
  2. Green Start Button

    DataGrid.Items.Count and DataGrid Paging...

    Green Start Button, Aug 4, 2005, in forum: ASP .Net
    Replies:
    2
    Views:
    5,822
    agravar
    Aug 2, 2006
  3. Patrick.O.Ige
    Replies:
    3
    Views:
    527
    Patrick.O.Ige
    Oct 17, 2005
  4. JustinCarmony
    Replies:
    1
    Views:
    440
    =?Utf-8?B?UGV0ZXIgQnJvbWJlcmcgW0MjIE1WUF0=?=
    Apr 2, 2007
  5. DC Gringo

    total record count in datagrid

    DC Gringo, Mar 4, 2004, in forum: ASP .Net Datagrid Control
    Replies:
    0
    Views:
    129
    DC Gringo
    Mar 4, 2004
Loading...

Share This Page