"WebForm" Repeater serial number self-increment in the case of page flipping

Source: Internet
Author: User

When the ASP. NET repeater control is paged, the Sequence Number column page restarts starting from 1 counting problem solving ideas and methods:

In general, use <%# Container.itemindex + 1% > To add an ordinal column.

But in the case of paging, the result is to start again on the next page. The information found on the Web is the solution is to bind <% #Container. datasetindex+1%>, there are also some in the background to construct an ordinal column to solve, are very troublesome. Finally found the simplest way to solve, is to write a ternary operator to determine whether the first page

  

<% #AspNetPager1 .currentpageindex>1? (aspnetpager1.currentpageindex-1) *aspnetpager1.pagesize+container.itemindex+1: container.itemindex+1 %>

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: info-contact@alibabacloud.com 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.