一、AspNetPager支持两种方式分页:
一种是PostBack方式分页,
一种是通过Url来实现分页以及Url重写功能
二、AspNetPager支持各种数据绑定控件GridView、DataGrid、DataList、Repeater以及自定义的数据绑定控件的分页功能十分强大。
三、AspNetPager分页控件本身并不显示任何数据,而只显示分页导航元素,数据在页面上的显示方式与该控件无关,所以需要手写数据连接方法来配合,
四、结合TOP 。。。NOT IN 的通用存储过程分页方法使用AspNetPager十分实用

测试控件datalist aspnetpager 的分页方法示例   分页方法为 PostBack 方式
1、 首先将AspNetPager.dll复制于应用程序下的bin目录,打开解决方案,引入dll文件
2、 在工具栏中添加控件,这样可以支持拖拽使用
3、  要使用AspNetPager 要为其设置最基本的属性
使用 SqlServer Northwind数据库的 Products表
protected Wuqi.Webdiyer.AspNetPager AspNetPager1;
protected System.Web.UI.WebControls.Label Label1;
protected System.Web.UI.WebControls.DataList DataList1;
private void Page_Load(object sender, System.EventArgs e)
{
       this.AspNetPager1.PageSize=10;     //设置每也显示的记录条数
       if(!IsPostBack)                       //只在页面第一次加载时起作用
       {
              SqlDBManager db = new SqlDBManager(System.Configuration.ConfigurationSettings.AppSettings["SqlConnectionString"]);
              AspNetPager1.RecordCount=db.CountPage("products");//获得要使用表的记录总数
                                                                                             //db.CountItems自定义的方法
              this.BindData();                                  
       }
}
private void BindData()
{
       SqlDBManager db= new SqlDBManager(System.Configuration.ConfigurationSettings.AppSettings["SqlConnectionString"].ToString();
       DataList1.DataSource=db.FenPage(this.AspNetPager1.PageSize,this.AspNetPager1.CurrentPageIndex,"productid","products","productid,productname,unitprice,unitsinstock","");
//自定义方法由 TOP not in 存储过程分页方法改编
       this.DataList1.DataBind();                //控件数据绑定
       this.Label1.Text="当前第"+this.AspNetPager1.CurrentPageIndex+"页 总"+this.AspNetPager1.PageCount+"页";
}
private void AspNetPager1_PageChanged(object sender, System.EventArgs e)
{       //页索引改变方法
    this.BindData();
}

设计页效果
<asp:DataList id="DataList1" style="Z-INDEX: 101; LEFT: 296px; POSITION: absolute; TOP: 96px" runat="server">
       <HeaderTemplate>
              <table border='1'>
                     <tr>
                            <td>产品ID</td>
                            <td>产品名称</td>
                            <td>产品数量</td>
                            <td>产品单价</td>
                     </tr>
       </HeaderTemplate>
       <FooterTemplate>
              </table>
</FooterTemplate>
       <ItemTemplate>
              <tr>
                            <td><%# DataBinder.Eval(Container.DataItem,"Productid")%></td>
                          <td><%# DataBinder.Eval(Container.DataItem,"productname")%></td>
                            <td><%# DataBinder.Eval(Container.DataItem,"unitprice")%></td>
                            <td><%# DataBinder.Eval(Container.DataItem,"unitsinstock")%></td>
                     </tr>
       </ItemTemplate>
</asp:DataList>
<webdiyer:AspNetPager id="AspNetPager1" style="Z-INDEX: 102; LEFT: 256px; POSITION: absolute; TOP: 40px" runat="server" Width="500px" FirstPageText="首页" LastPageText="尾页" NextPageText="下一页" PrevPageText="上一页" Height="40px" NumericButt PagingButt ShowNavigati ShowInputBox="Always" TextAfterInputBox="页" TextBeforeInputBox="跳转到第" AlwaysShow="True">
</webdiyer:AspNetPager>
<asp:Label id="Label1" style="Z-INDEX: 103; LEFT: 120px; POSITION: absolute; TOP: 56px" runat="server">Label</asp:Label>

AspNetPager使用方法的更多相关文章

  1. AspNetPager

    AspNetPager使用方法引入dll <%@ Register assembly="AspNetPager" namespace="Wuqi.Webdiyer& ...

  2. 关于MySql的DBHelper类以及数据分页

    前端: <%@ Register Assembly="AspNetPager" Namespace="Wuqi.Webdiyer" TagPrefix=& ...

  3. 关于SqlServer的DBHelper类以及数据分页

    前端: <My:AspNetPager class="arPage" PageSize="20" UrlPaging="true" r ...

  4. javaSE27天复习总结

    JAVA学习总结    2 第一天    2 1:计算机概述(了解)    2 (1)计算机    2 (2)计算机硬件    2 (3)计算机软件    2 (4)软件开发(理解)    2 (5) ...

  5. AspNetPager控件分页使用方法

    AspNetPager控件官方下载地址:http://www.webdiyer.com/aspnetpager/ 把控件加到项目中(添加自定义控件的方法),并把它拖放到页面上 <asp:Scri ...

  6. AspNetPager分页控件使用方法

    一.下载AspNetPager.dll 二.AspNetPager.dll复制于应用程序下的bin目录,打开解决方案,引用dll文件 三. 在工具栏中添加控件,这样可以支持拖拽使用 四. 要使用Asp ...

  7. aspnetpager的2种分页方法

    <webdiyer:AspNetPager ID="AspNetPager1" UrlPaging="True" PageSize="20&qu ...

  8. 第三方分页控件aspnetPager出现问题解决方法

    问题描述: 今天在打开以前的项目使用vs2013打开后并且生成解决方案的时候发现报错了.经过检查发现是由于第三方分页控件aspnetPager在页面上不能引用到了. 解决方法: 1. 首先将AspNe ...

  9. AspNetPager分页控件的使用方法

    1. 首先将AspNetPager.dll复制于应用程序下的bin目录,打开解决方案,引入dll文件 (通过NuGet获取) 2. 在工具栏中添加控件,这样可以支持拖拽使用 3.页面拖入分页控件,设置 ...

随机推荐

  1. Lua脚本和C++交互(一)

    现在,越来越多的C++服务器和客户端融入了脚本的支持,尤其在网游领域,脚本语言已经渗透到了方方面面,比如你可以在你的客户端增加一个脚本,这个脚本将会帮你在界面上显示新的数据,亦或帮你完成某些任务,亦或 ...

  2. eclipse cdt运行c程序报错“launch failed,binary not found”

    1. 安装了eclipsecdt版 2. 采用mingw 编译第一个c程序,报错“launch failed,binary not found”.检查是mingw下的bin目录在环境变量里设置错了. ...

  3. 普通for循环和增强for循环的区别

    1.普通for循环:自行维护循环次数,循环体自行维护获取元素的方法: int[] array = new int[]{1,2,3,4,5}; //int[] array ={1,2,3,4,5} ; ...

  4. 简单的Excel导入(上传、解析、持久化)

    /** * excel导入 * @param req * @param resp * @return */ public void excelImport(){ //先将要上传的Excel文件上传到项 ...

  5. 基于VLAN的二三层转发

    [章节内容]1 MAC地址2 冲突域和广播域3 集线器.交换机.路由器   3.1 集线器   3.2 网桥和交换机   3.3 路由器4 VLAN   4.1 VLAN帧格式      4.1.1 ...

  6. 脚本学习 game.sh

    #!/bin/bash #game_error.sh ]]; then #$#表示参数个数 -lt小于 echo "Usage: game_error.sh time[20170710]&q ...

  7. Effective Java (6) - 消除过期的对象引用

    一.引言 很多人可能在想这么一个问题:Java有垃圾回收机制,那么还存在内存泄露吗?答案是肯定的,所谓的垃圾回收GC会自动管理内存的回收,而不需要程序员每次都手动释放内存,但是如果存在大量的临时对象在 ...

  8. java基础---->git的使用(一)

    这里面记录一下git的使用,只是平时工作中遇到的一些问题的解决方案,不会涉及到git的一些基础概念及说明.人的天性便是这般凉薄,只要拿更好的来换,一定舍得. Git的一些使用 一.在码云建立好仓库之后 ...

  9. linux下文件描述符的介绍

    当某个程序打开文件时,操作系统返回相应的文件描述符,程序为了处理该文件必须引用此描述符.所谓的文件描述符是一个低级的正整数.最前面的三个文件描述符(0,1,2)分别与标准输入(stdin),标准输出( ...

  10. 报错---“node install.js”

    如图 解决方案: 目录中执行 npm install chromedriver --chromedriver_cdnurl=http://cdn.npm.taobao.org/dist/chromed ...