Add a row number when binding the Repeater control

Source: Internet
Author: User
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 ();

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.