numbering rows in datagrid

Discussion in 'ASP .Net' started by buran, Jul 7, 2003.

  1. buran

    buran Guest

    Dear ASP.NET Programmers,



    I am using the datagrid control (grdSPs) to display database data. The
    datagrid allows paging. What I am trying to do is to insert row numbers
    automatically. I can do this, but with every consequent page, the index
    starts again from 1. How can I make it to continue from the row number on
    the previous page?

    Thanks in advance,



    Buran
    buran, Jul 7, 2003
    #1
    1. Advertising

  2. buran

    Vincent V Guest

    maybe u should do this at datalevel
    there arse some ways i gues u gould do this with dataset events
    "buran" <> wrote in message
    news:...
    > Dear ASP.NET Programmers,
    >
    >
    >
    > I am using the datagrid control (grdSPs) to display database data. The
    > datagrid allows paging. What I am trying to do is to insert row numbers
    > automatically. I can do this, but with every consequent page, the index
    > starts again from 1. How can I make it to continue from the row number on
    > the previous page?
    >
    > Thanks in advance,
    >
    >
    >
    > Buran
    >
    >
    Vincent V, Jul 7, 2003
    #2
    1. Advertising

  3. buran

    Saravana Guest

    Check out this code, which will do the work which you wanted

    <asp:datagrid id="DataGrid1" runat="server" AllowSorting="True"
    AllowCustomPaging="True" AllowPaging="True" PagerStyle-Mode="NumericPages"
    PageSize="10" PagerStyle-NextPageText="next" PagerStyle-PrevPageText="Prev"
    >

    <Columns>
    <asp:templatecolumn headertext="Row Number">
    <itemtemplate>
    <%# DataGrid1.PageSize*DataGrid1.currentPageindex + Container.ItemIndex+1
    %>
    </itemtemplate>
    </asp:templatecolumn>
    </columns>

    </asp:datagrid>



    --
    Saravana
    Microsoft India Community Star,
    MCAD,SE,SD,DBA.


    "buran" <> wrote in message
    news:...
    > Dear ASP.NET Programmers,
    >
    >
    >
    > I am using the datagrid control (grdSPs) to display database data. The
    > datagrid allows paging. What I am trying to do is to insert row numbers
    > automatically. I can do this, but with every consequent page, the index
    > starts again from 1. How can I make it to continue from the row number on
    > the previous page?
    >
    > Thanks in advance,
    >
    >
    >
    > Buran
    >
    >
    Saravana, Jul 7, 2003
    #3
    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, Oct 15, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    514
    Cowboy \(Gregory A. Beamer\)
    Oct 15, 2003
  2. buran

    numbering rows in datagrid

    buran, Jul 7, 2003, in forum: ASP .Net Datagrid Control
    Replies:
    2
    Views:
    170
    Saravana
    Jul 7, 2003
  3. 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
  4. buran

    numbering rows in datagrid

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

    numbering rows in datagrid

    buran, Oct 15, 2003, in forum: ASP .Net Web Controls
    Replies:
    1
    Views:
    155
    Cowboy \(Gregory A. Beamer\)
    Oct 15, 2003
Loading...

Share This Page