DataList分页-增加自动编号列

 1 <asp:DataList ID="dl_XUDAXIA" runat="server">                
 2    <HeaderTemplate>
 3      <table cellpadding="0" cellspacing="0"><tr><td align="center">Entry</td></tr></table>
 4    </HeaderTemplate>
 5    <ItemTemplate>
 6      <table cellpadding="0" cellspacing="0"><tr><td align="center">
 7        <%#Container.ItemIndex+1+(Int32.Parse(labPage.Text)-1)*pageSize %>      
 8      </td></tr></table>
 9    </ItemTemplate>
10    <HeaderStyle HorizontalAlign="Center" />
11 </asp:DataList>

附注:

labPage.Text为当前页
pageSize后台变量:public int pageSize

原文地址:https://www.cnblogs.com/byvar/p/3945740.html