numbering rows in datagrid

Discussion in 'ASP .Net Web Controls' 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. Advertising

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

    numbering rows in datagrid

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

    numbering rows in datagrid

    buran, Oct 15, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    514
    Cowboy \(Gregory A. Beamer\)
    Oct 15, 2003
  3. buran

    numbering rows in datagrid

    buran, Jul 7, 2003, in forum: ASP .Net Datagrid Control
    Replies:
    2
    Views:
    171
    Saravana
    Jul 7, 2003
  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:
    615
    Thomas Kopp
    Mar 1, 2007
  5. buran

    numbering rows in datagrid

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

Share This Page