numbering rows in datagrid

Discussion in 'ASP .Net' started by buran, Oct 15, 2003.

  1. buran

    buran Guest

    Dear ASP.NET Users,

    How can I get the total number of rows selected by the command text of the
    datagrid (items in datagrid)? If I use the statement grdSP.Items.Count with
    the datagrid grdSP with paging, it returns the page size (5,10..) not the
    total results. How can I get the total no?
    Thanks in advance,

    Buran
     
    buran, Oct 15, 2003
    #1
    1. Advertisements

  2. Depends. If you are using a DataSet to bind, you can do the following:

    int rowCount = DataSet1.Tables[0].Rows.Count;

    or VB.NET

    Dim rowCount as Integer = DataSet1.Tables(0).Rows.Count

    If you are using a DataReader, you have to stream through the entire reader
    to get the end result. For paging and sorting, DataReaders are not the best
    option overall.

    --
    Gregory A. Beamer
    MVP; MCP: +I, SE, SD, DBA

    **********************************************************************
    Think Outside the Box!
    **********************************************************************
    "buran" <> wrote in message
    news:...
    > Dear ASP.NET Users,
    >
    > How can I get the total number of rows selected by the command text of the
    > datagrid (items in datagrid)? If I use the statement grdSP.Items.Count

    with
    > the datagrid grdSP with paging, it returns the page size (5,10..) not the
    > total results. How can I get the total no?
    > Thanks in advance,
    >
    > Buran
    >
    >
     
    Cowboy \(Gregory A. Beamer\), Oct 15, 2003
    #2
    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. buran

    numbering rows in datagrid

    buran, Jul 7, 2003, in forum: ASP .Net
    Replies:
    2
    Views:
    586
    Saravana
    Jul 7, 2003
  2. buran

    numbering rows in datagrid

    buran, Jul 7, 2003, in forum: ASP .Net Datagrid Control
    Replies:
    2
    Views:
    255
    Saravana
    Jul 7, 2003
  3. Aminoplacid

    Datagrid ClientID Numbering Problem

    Aminoplacid, Aug 17, 2006, in forum: ASP .Net Datagrid Control
    Replies:
    1
    Views:
    436
    Teemu Keiski
    Aug 26, 2006
  4. Thomas Kopp

    hide/delete rows & the consequent page numbering problem

    Thomas Kopp, Mar 1, 2007, in forum: ASP .Net Datagrid Control
    Replies:
    0
    Views:
    753
    Thomas Kopp
    Mar 1, 2007
  5. buran

    numbering rows in datagrid

    buran, Jul 7, 2003, in forum: ASP .Net Web Controls
    Replies:
    2
    Views:
    254
    Saravana
    Jul 7, 2003
  6. buran

    numbering rows in datagrid

    buran, Oct 15, 2003, in forum: ASP .Net Web Controls
    Replies:
    1
    Views:
    262
    Cowboy \(Gregory A. Beamer\)
    Oct 15, 2003
  7. Chris Hoare

    Datagrid page numbering

    Chris Hoare, Jul 13, 2004, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    194
    Chris Hoare
    Jul 13, 2004
  8. Elroyskimms

    DataGrid Row Numbering On Empty Reader

    Elroyskimms, Aug 11, 2005, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    197
    Elroyskimms
    Aug 11, 2005
Loading...