今天在用.net 做网站的时候,用到了DATALIST,但是datalist 没有自带的分页控件,后来在网上找了好长时间,看了aspnetpager.dll这个控件,这个控件挺好用的.我把使用方法写出来,大家可以参考一下。

先网上下载一个分页的控件。AspNetPager.dll 这个文件。

先引用进来,添加引用那里添加进来。你也可以到工具箱那里,添加引用一下,工具箱上会多一个分页的控件的,到时候只要拖进到页面上就行了。

<%@ Register Assembly="AspNetPager" Namespace="Wuqi.Webdiyer" TagPrefix="webdiyer" %>

这个放到页面头部

<webdiyer:AspNetPager ID="AspNetPager1" runat="server" Width="100%" NumericButtonCount="6" UrlPaging="true" NumericButtonTextFormatString="[{0}]" CustomInfoHTML="第 <font color='red'><b>%CurrentPageIndex%</b></font> 页 共 %PageCount% 页 显示 %StartRecordIndex%-%EndRecordIndex% 条" ShowCustomInfoSection="left"
FirstPageText="首页" LastPageText="末页" NextPageText="下页" PrevPageText="上页" Font-Names="Arial" BackColor="#EDEDED" AlwaysShow="true"   SubmitButtonText="跳转" SubmitButtonStyle="botton" OnPageChanging="AspNetPager1_PageChanging1" HorizontalAlign="Right" >
              </webdiyer:AspNetPager>

这个是一个写好的分页控件。样式都写好了~!

bind() 这个 方法可以写到页面加载的地方load里面

if(!ispostback)

{

bind();

}

-------------------------------------------------------------------------

private void bind()
    {

DataSet ds = new DataSet();
        string sql = "select b.* from  users";
        ds = conn.GetReader(sql);///用来统计总数用。。。。。conn.GetReader()是自己写的一个方法返回dataset
        this.AspNetPager1.RecordCount = ds.Tables[0].Rows.Count;/////需要把记录的总数统计出来赋值给控件
        int pageIndex = this.AspNetPager1.CurrentPageIndex - 1;//定义要显示的页面
        int pageSize = this.AspNetPager1.PageSize = 6;///定义每页显示6条信息
 
        DataSet dd = new DataSet();
        dd = GVBind(sql, pageIndex, pageSize);

this.dlp.DataSource = dd;
        dlp.DataBind();

}

protected void AspNetPager1_PageChanging1(object src, Wuqi.Webdiyer.PageChangingEventArgs e)
    {
       AspNetPager1.CurrentPageIndex = e.NewPageIndex;
        bind();
    }

public static DataSet GVBind(string strCom, int i1, int i2)
    {
        int firstPage = i1 * i2;

SetConnection();/////调用数据链接的,我就不写出来
        DataSet ds = new DataSet();
        OleDbDataAdapter myDbAdp = new OleDbDataAdapter(strCom, myDbCon);

myDbAdp.Fill(ds, firstPage, i2, "article");
        return ds;
    }

AspNetPager.dll 分页控件使用的更多相关文章

  1. AspNetPager 免费分页控件7.5.1版发布!

    AspNetPager 免费分页控件7.5.1版发布,本次升级主要内容有: 修正了ShowDisabledButtons为false时html闭合标签丢失的bug:改为从System.Web.UI.W ...

  2. PagedDataSource数据绑定控件和AspNetPager分页控件结合使用列表分页

    1.引用AspNetPager.dll. 2.放置Repeater数据绑定控件. <asp:Repeater ID="Repeater1" runat="serve ...

  3. AspNetPager分页控件配置

    AspNetPager是asp.net中常用的分页控件,下载AspNetPager.dll,添加引用,在工具栏就可以看到AspNetPager控件: 拖过来之后,设置如下属性: <webdiye ...

  4. AspNetPager分页控件

    AspNetPager分页控件解决了分页中的很多问题,直接采用该控件进行分页处理,会将繁琐的分页工作变得简单化,下面是我如何使用AspNetPager控件进行分页处理的详细代码:1.首先到www.we ...

  5. 【转】AspNetPager分页控件用法

    AspNetPager分页控件解决了分页中的很多问题,直接采用该控件进行分页处理,会将繁琐的分页工作变得简单化,下面是我如何使用AspNetPager控件进行分页处理的详细代码: 1.首先到www.w ...

  6. 分页控件-ASP.NET(AspNetPager)

    AspNetPager是asp.net中常用的分页控件,下载AspNetPager.dll,添加引用,在工具栏就可以看到AspNetPager控件: <div class="oa-el ...

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

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

  8. 分页控件AspNetPager学习笔记

    1.AspNetPager简介 AspNetPager是一款开源.简单易用.可定制化等等各种优点的Web分页控件. 2.使用方法 1)下载AspNetPager.dll文件(http://www.we ...

  9. web分页控件AspNetPager的使用

    首先要先引用AspNetPager.dll文件 然后在<html>上面添加下面代码: <%@ Register Assembly="AspNetPager" Na ...

随机推荐

  1. [NodeJS] Node.js 与 V8 的故事

    要说Node.js的历史,就不得不说说V8历史.在此之前我们先一句话描述一下什么是Node.js:Node.js是一个基于Google Chrome V8 Javascript引擎之上的平台,用以创建 ...

  2. Kafka producer拦截器(interceptor)

    Producer拦截器(interceptor)是个相当新的功能,它和consumer端interceptor是在Kafka 0.10版本被引入的,主要用于实现clients端的定制化控制逻辑. 对于 ...

  3. flask操作mongo两种方式--ORM

    #manage.py #coding=utf-8 #Flask-Script是一个可以在flask应用外部编写脚本的扩展 #常用功能: #运行一个开发的服务器 #python shell中操作数据库看 ...

  4. ajax劫持?

    <html<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=ut ...

  5. Illegal mix of collations for operation 'concat'

    在t_employee表中,练习使用concat函数连接字符串时, mysql> select concat('工号为:',fnumber,'的员工的幸福指数:',fsalary/(fage-2 ...

  6. ldap objectclass

    LDAP中,一个条目必须包含一个objectClass属性,且需要赋予至少一个值.每一个值将用作一条LDAP条目进行数据存储的模板:模板中包含了一个条目必须被赋值的属性和可选的属性.      obj ...

  7. 【Spring源码分析系列】加载Bean

    /** * Create a new XmlBeanFactory with the given input stream, * which must be parsable using DOM. * ...

  8. MFC 消息映射表和虚函数实现消息映射到底谁的效率高

    深入浅出MFC对于虚函数实现方式的缺点,它指出:虚函数耗费大量内存,系统最终将被这些额外负担拖垮. 但是现在对于容量巨大的白菜价格的内存来说,这种额外负担是否已经过时了呢~?    书中提到,虚函数表 ...

  9. Entity Framework6测试使用

    Entity Framework6安装完成后测试下 上一篇中完成了对Entity Framework6的下载安装,一下做一个简单的数据添加测试 1.创建一个简单的控制台测试项目 2.创建实体数据模型 ...

  10. CF 445A DZY Loves Chessboard

    A. DZY Loves Chessboard time limit per test 1 second memory limit per test 256 megabytes input stand ...