The best method is, of course, to obtain the row number when extracting data. SQL Server has the row_number () function, but a recent project uses MySQL, I checked on the Internet and there are no ready-made functions. I said I had to write them on the Internet, so I was too lazy to write them.ProgramThe output line number is good. You can use <% # container when binding. itemindex + 1%> to bind the row number. However, if there is a paging, the row number starts from 1.
I thought about the solution as follows:
The ANP paging control is used to obtain the number starting from the specified number, so that the row number can be output,
Front-end bindingCodeAs follows:
<% # Getxh (container. itemindex) %>
The background code is as follows:
// Get sequence number
Public String Getxh ( Object Index)
{
// Return (ANP. currentpageindex-1) * ANP. pagesize) + Int. parse (index. tostring () + 1). tostring ();
Return (ANP. startrecordindex + Int . Parse (index. tostring (). tostring ();
}