numbering rows in datagrid

B

buran

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
 
V

Vincent V

maybe u should do this at datalevel
there arse some ways i gues u gould do this with dataset events
 
S

Saravana

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>
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,731
Messages
2,569,432
Members
44,832
Latest member
GlennSmall

Latest Threads

Top