前台使用jquery.pagination.js
后台使用AspNetPager
<%@ Register Assembly="AspNetPager" Namespace="Wuqi.Webdiyer" TagPrefix="webdiyer" %>
添加AspNetPager.dll引用
<div class="list-page">
<div runat="server" id="divsj">
</div>
<asp:Label ID="recordstatus" runat="server" Text="没有记录" Visible="false"></asp:Label>
<table align='center' width="100%" style="padding-top: 15px;">
<tr>
<td class="page" align="center">
<webdiyer:AspNetPager ID="AspNetPager1" AlwaysShow="True" runat="server" PagingButtonSpacing="10px"
showcustominfo="True" ShowCustomInfoSection="Never" Width="100%" NumericButtonCount="5"
OnPageChanging="pageBind_PageChanging" CenterCurrentPageButton="True" FirstPageText="首 页"
LastPageText="尾 页" NextPageText="下 页" NumericButtonType="Image" PrevPageText="上 页"
ShowNavigationToolTip="True" ShowPageIndexBox="Never" CustomInfoHTML="" CustomInfoSectionWidth="30%"
CustomInfoTextAlign="Left">
</webdiyer:AspNetPager>
</td>
</tr>
</table>
</div>
DataTable dt = //查数据
this.rpt1.DataSource = dt;
this.rpt1.DataBind();
if (dt.Rows.Count == 0)
{
recordstatus.Visible = true;
AspNetPager1.Visible = false;
}
else
{
AspNetPager1.Visible = true;
recordstatus.Visible = false;
}
pagecount = Convert.ToInt32(Math.Floor((float)recordcount / PAGE_SIZE)); //总页码
if (recordcount % PAGE_SIZE != 0) pagecount += 1;
if (pagecount <= 0) pagecount = 1;
int minRowIndex = currentpage - 1;
if (minRowIndex < 1) minRowIndex = 0;
AspNetPager1.PageSize = PAGE_SIZE;
AspNetPager1.RecordCount = recordcount;
AspNetPager1.CurrentPageIndex = currentpage;
AspNetPager1.CustomInfoHTML = " 总:<font color=\"blue\"><b>" + AspNetPager1.RecordCount.ToString() + "</b></font>条 ";
AspNetPager1.CustomInfoHTML += " <font color=\"red\"><b>" + AspNetPager1.PageSize.ToString() + "</b></font>/页";
AspNetPager1.CustomInfoHTML += " 总页数:<font color=\"blue\"><b>" + AspNetPager1.PageCount.ToString() + "</b></font>";
AspNetPager1.CustomInfoHTML += " 第<font color=\"red\"><b>" + AspNetPager1.CurrentPageIndex.ToString() + "</b></font>页";