长话短说,首先看repeater 配合 webdiyer AspNetPager使用时webdiyer AspNetPager属性设置代码。
<webdiyer:AspNetPager ID="AspNetPager1" runat="server" CssClass="paginator" OnPageChanging="AspNetPager1_PageChanging"
CurrentPageButtonClass="cpb" FirstPageText="首页" LastPageText="尾页" NextPageText="下一页"
PrevPageText="上一页" ShowMoreButtons="true" ShowCustomInfoSection="Right" CustomInfoTextAlign="Right"
LayoutType="Table" ShowPageIndexBox="Never" SubmitButtonText="跳转" PageSize="18"
CustomInfoHTML="共%PageCount%页/第%CurrentPageIndex%页,每页%PageSize%条,总记录数:%RecordCount%"
UrlPaging="True" AlwaysShow="true">
</webdiyer:AspNetPager>
从 上边代码可看出,此分页传值方式为URL传值。当使用<%#Container.ItemIndex+1%>来生成序号时,第二页序号依然从1开始,理想情况下的话,应该从3开始。
【C#】 后台处理方法:
/// <summary>
/// 序号生成
/// </summary>
/// <param name="ItemIndex">数据Index</param>
/// <returns></returns>
public string ReturnOrder(int ItemIndex)
{
int page = ;
if (Request.QueryString["page"] != null)
{
page = int.Parse(Request.QueryString["page"]) - ;
} int strXM = page * AspNetPager1.PageSize + ItemIndex;
return strXM.ToString();
}
【html】前台调用代码:
<td style="white-space: nowrap" align="center">
<%# ReturnOrder(Container.ItemIndex+1)%>
</td>
效果: