AspNetPager.dll 分页控件使用
今天在用.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 分页控件使用的更多相关文章
- AspNetPager 免费分页控件7.5.1版发布!
AspNetPager 免费分页控件7.5.1版发布,本次升级主要内容有: 修正了ShowDisabledButtons为false时html闭合标签丢失的bug:改为从System.Web.UI.W ...
- PagedDataSource数据绑定控件和AspNetPager分页控件结合使用列表分页
1.引用AspNetPager.dll. 2.放置Repeater数据绑定控件. <asp:Repeater ID="Repeater1" runat="serve ...
- AspNetPager分页控件配置
AspNetPager是asp.net中常用的分页控件,下载AspNetPager.dll,添加引用,在工具栏就可以看到AspNetPager控件: 拖过来之后,设置如下属性: <webdiye ...
- AspNetPager分页控件
AspNetPager分页控件解决了分页中的很多问题,直接采用该控件进行分页处理,会将繁琐的分页工作变得简单化,下面是我如何使用AspNetPager控件进行分页处理的详细代码:1.首先到www.we ...
- 【转】AspNetPager分页控件用法
AspNetPager分页控件解决了分页中的很多问题,直接采用该控件进行分页处理,会将繁琐的分页工作变得简单化,下面是我如何使用AspNetPager控件进行分页处理的详细代码: 1.首先到www.w ...
- 分页控件-ASP.NET(AspNetPager)
AspNetPager是asp.net中常用的分页控件,下载AspNetPager.dll,添加引用,在工具栏就可以看到AspNetPager控件: <div class="oa-el ...
- 第三方分页控件aspnetPager出现问题解决方法
问题描述: 今天在打开以前的项目使用vs2013打开后并且生成解决方案的时候发现报错了.经过检查发现是由于第三方分页控件aspnetPager在页面上不能引用到了. 解决方法: 1. 首先将AspNe ...
- 分页控件AspNetPager学习笔记
1.AspNetPager简介 AspNetPager是一款开源.简单易用.可定制化等等各种优点的Web分页控件. 2.使用方法 1)下载AspNetPager.dll文件(http://www.we ...
- web分页控件AspNetPager的使用
首先要先引用AspNetPager.dll文件 然后在<html>上面添加下面代码: <%@ Register Assembly="AspNetPager" Na ...
随机推荐
- Kubernetes kubectl 命令
kubectl 命令用来操作 Kubernetes 集群中的资源对象,包括对资源的创建.删除.查看.修改.配置.运行等 命令语法:kubectl [command] [TYPE] [NAME] [fl ...
- Elasticsearch 5.x 关于term query和match query的认识
http://blog.csdn.net/yangwenbo214/article/details/54142786 一.基本情况 前言:term query和match query牵扯的东西比较多, ...
- Mybatis输入输出映射
一.输入映射 1.传递简单类型 <select id="findUserById" parameterType="int" resultType=&quo ...
- 使用VS Code写PHP并进行调试
VS Code(Visual Studio Code)是由微软研发的一款免费.开源的跨平台文本(代码)编辑器. 1.先从官网下载安装好VS Code.官方下载地址是https://code.visua ...
- Python基础---->python的使用(二)
学习一下python,这里对python的基础知识做一个整理.似等了一百年忽而明白,即使再见面,成熟地表演,不如不见. python的一些应用 一.类似于java中的MessageFormat用法 w ...
- 深入理解 Neutron -- OpenStack 网络实现(2):VLAN 模式
问题导读 1.br-int.br-ethx的作用是什么?2.安全组策略是如何实现的?3.VLAN 模式与GRE模式有哪些不同点?流量上有哪些不同?4.L3 agent实现了什么功能? 接上篇深入理解 ...
- 查看iOS沙盒(SanBox)文件
转载:http://www.2cto.com/kf/201211/169212.html 每一个iOS程序都一个自己的文件系统,这个文件系统叫应用程序沙盒(SanBox),它存放这代码以外的文件,其他 ...
- Android 控制闪光灯
首先闪光灯可以用android.hardware.camera来控制. 1.添加权限 <uses-permission android:name="android.permission ...
- window下node更新
打开cmd查看你之前node版本安装的路径,where node: 直接去官网下载与你电脑系统(32位还是64位)对应的最新的mis版本,安装在上述路径中覆盖即可. 注意:windows上并不支持n模 ...
- php应用
1. php判断是否为数字 is_numeric() 这个函数就是检测参数是否为数字,如果是就返回true,如果不是就返回false is_numeric( 'abcd123' ) or die('提 ...