码迷,mamicode.com
首页 > Web开发 > 详细

AspNetPager分页

时间:2014-11-10 13:28:29      阅读:241      评论:0      收藏:0      [点我收藏+]

标签:io   os   sp   on   cti   bs   html   ef   size   

 

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分页

标签:io   os   sp   on   cti   bs   html   ef   size   

原文地址:http://www.cnblogs.com/renshen555/p/4086858.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!