首页 > 代码库 > AspNetPager分页

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);

AspNetPager分页