今天在用.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. 第一篇:Hadoop简介

    前言 本文大致介绍下Hadoop的一些背景知识,为后面深入学习打下铺垫. 什么是Hadoop Hadoop是一个开源分布式计算平台,它以HDFS文件系统和MapReduce计算框架为核心. 前者能够让 ...

  2. Nginx 72万连接性能测试(一)

    转自:http://my.oschina.net/chenzhuo/blog/150200?p=2#comments 根据系统内存64G估算单台tengine做反向代理最高支持72万连接.为了验证达到 ...

  3. Lua学习笔记 入门的两个小程序

    [Hello World]第一个Lua程序将遵循传统做法,打印一句“Hello World”: print("Hello World") [阶乘]下面的程序用于输出输入值对应的阶乘 ...

  4. Apache HTTP Server 与 Tomcat 的三种连接方式介绍

    本文转载自IBM developer 首先我们先介绍一下为什么要让 Apache 与 Tomcat 之间进行连接.事实上 Tomcat 本身已经提供了 HTTP 服务,该服务默认的端口是 8080,装 ...

  5. 关于PHP中的 serialize () 和 unserialize () 的使用(即关于PHP中的值与已存储的表示的相互转换)

    有时,我们会碰到这样的数据(字符串) 1 a:3:{i:0;s:44:"/Uploads/images/2017-07-21/5971a9a08ad57.png";i:1;s:44 ...

  6. vim重复操作的宏录制

    在编辑某个文件的时候,可能会出现需要对某种特定的操作进行许多次的情况,以编辑下面的文件为例: ;==================================================== ...

  7. 【分布式系列之ActiveMq】ActiveMq入门示例

    前言 github地址:https://github.com/AndyFlower/web-back/tree/master/ActiveMq01 下载ActiveMQ :http://activem ...

  8. C#设计模式--工厂方法模式

    0.C#设计模式-简单工厂模式 设计模式: 工厂方法模式(Factory Method Pattern) 介绍:简单工厂模式是要在工厂类中通过数据来做个决策,在工厂类中的多个类中实例化出来其中一个要用 ...

  9. 题目1440:Goldbach's Conjecture(哥达巴赫猜想)

    题目链接:http://ac.jobdu.com/problem.php?pid=1440 详解链接:https://github.com/zpfbuaa/JobduInCPlusPlus 参考代码: ...

  10. 检查mono兼容性的工具MOAM

    mono的迁移工具,可以帮助我们从windows平台迁移到Linux平台,可以用来检测特定的.net的dll或exe程序对mono的兼容性,并能够给出不兼容的方法 项目地址 MoMA 项目介绍 MoM ...