zoukankan      html  css  js  c++  java
  • 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);

  • 相关阅读:
    XML约束之DTD
    XML基础
    向方法传递多个参数
    从方法里返回值
    给方法传值
    对象状态和行为
    对象类型数组
    数组
    避开关键字
    primitive数据类型
  • 原文地址:https://www.cnblogs.com/renshen555/p/4086858.html
Copyright © 2011-2022 走看看