AspNetPager分页
1.页面部分
<%@ Register Assembly="AspNetPager" Namespace="Wuqi.Webdiyer" TagPrefix="webdiyer" %>
<webdiyer:AspNetPager ID="AspNetPager1" runat="server" PageSize="10"
CustomInfoHTML="每页 %PageSize% 行 共 %RecordCount% 行 / 第 %CurrentPageIndex% 页 共 %PageCount% 页" FirstPageText="首页"
LastPageText="末页" NextPageText="下一页" PrevPageText="上一页"
ShowCustomInfoSection="Left" ShowPageIndexBox="Always"
PageIndexBoxClass="txtanp" PagingButtonClass="" SubmitButtonClass="btnanp"
SubmitButtonText="" AlwaysShow="True" onpagechanged="anpage_PageChanged" >
</webdiyer:AspNetPager>
2.///AspNetPager分页公共方法,此处控件可以GridView,repeater等
public void GridViewBindDataTable(Repeater gv, DataTable table, Wuqi.Webdiyer.AspNetPager
anpPage)
{
PagedDataSource pds = new PagedDataSource();
pds.DataSource = table.DefaultView;
pds.AllowPaging = true;
anpPage.RecordCount = table.Rows.Count;
pds.CurrentPageIndex = anpPage.CurrentPageIndex - 1;
pds.PageSize = anpPage.PageSize;
gv.DataSource = pds;
gv.DataBind();
}
3.调用
this.GridViewBindDataTable(rp_backup, dt, AspNetPager1);
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。