AspNetPager分页控件的使用
下面所记得东西仅仅是使用方法,详细知识点请看链接:http://www.webdiyer.com/Controls/AspNetPager/Downloads
首先:从网站上下载并安装控件
下载地址: http://www.nuget.org/packages/AspNetPager_CN/(若无法打开,直接在Nuget中输入以下命令进行安装)
PM> Install-Package AspNetPager_CN
将控件拖进web窗体中,设置如下格式
<webdiyer:AspNetPager ID="AspNetPager1" runat="server" UrlPaging="true" AlwaysShow="true"
FirstPageText="首页" LastPageText="末页" OnPageChanged="AspNetPager1_PageChanged"
NextPageText="下一页" PrevPageText="上一页" CustomInfoHTML="目前是第%CurrentPageIndex%页 / 总共%PageCount%页"
ShowCustomInfoSection="Right" PagingButtonSpacing="0px" NumericButtonCount="5"
CssClass="anpager" CurrentPageButtonClass="cpb" Width="850px">
</webdiyer:AspNetPager>
样式如下:

后台代码
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
BindRepeater();
}
} private void BindRepeater()
{
int currentPage = AspNetPager1.CurrentPageIndex;
int pageSize = AspNetPager1.PageSize;
int recordCount; StudentDAL dal = new StudentDAL();
DataSet ds = dal.GetPage(currentPage, pageSize, out recordCount);
AspNetPager1.RecordCount = recordCount;
string ss = AspNetPager1.CustomInfoHTML;
//AspNetPager1.CustomInfoHTML += "共" + recordCount + "条新闻"; Repeater1.DataSource = ds;
Repeater1.DataBind(); } protected void AspNetPager1_PageChanged(object sender, EventArgs e)
{
BindRepeater();
}
DAL层代码
/// <summary>
/// 得到数据页
/// </summary>
/// <param name="currentPage">当前第几页</param>
/// <param name="pageSize">每页有多少条数据</param>
/// <param name="recordCount">数据总条数</param>
/// <returns></returns>
public DataSet GetPage(int currentPage, int pageSize, out int recordCount)
{
int start=;
if(currentPage<=)
{
}
else
{
start=(currentPage-)*pageSize;
} int end=currentPage*pageSize;
string sql = "select top "+pageSize+" * from T_Student where Id not in(select top "+start+" Id from T_Student)"; //SqlParameter[] ps = {
// new SqlParameter("@takeNum",pageSize),
// new SqlParameter("@skipNum",start)
// };
recordCount = (int)SqlHelper.ExecuteScalar("select count(1) from T_Student");
return SqlHelper.ExecuteDatable(CommandType.Text, sql);
}
同样可以设置控件css样式:

CSS样式:
/*先引入bootstrap.css*/
.pagination a[disabled]{ color: #777;cursor: not-allowed;background-color: #fff;border-color: #ddd;}
.pagination span.active{z-index: 2;color: #fff;cursor: default;background-color: #337ab7;border-color: #337ab7;}
属性设置:CssClass="pagination" LayoutType="Ul" PagingButtonLayoutType="UnorderedList" PagingButtonSpacing="0" CurrentPageButtonClass="active"
网易风格:

CSS样式:
.anpager .cpb {background:#1F3A87 none repeat scroll 0 0;border:1px solid #CCCCCC;color:#FFFFFF;font-weight:bold;margin:5px 4px 0 0;padding:4px 5px 0;}
.anpager a {background:#FFFFFF none repeat scroll 0 0;border:1px solid #CCCCCC;color:#1F3A87;margin:5px 4px 0 0;padding:4px 5px 0;text-decoration:none}
.anpager a:hover{background:#1F3A87 none repeat scroll 0 0;border:1px solid #1F3A87;color:#FFFFFF;}
属性设置:CssClass="anpager" CurrentPageButtonClass="cpb" PagingButtonSpacing="0"
拍拍网风格:

CSS样式:
.paginator { font: 11px Arial, Helvetica, sans-serif;padding:10px 20px 10px 0; margin: 0px;}
.paginator a {padding: 1px 6px; border: solid 1px #ddd; background: #fff; text-decoration: none;margin-right:2px}
.paginator a:visited {padding: 1px 6px; border: solid 1px #ddd; background: #fff; text-decoration: none;}
.paginator .cpb {padding: 1px 6px;font-weight: bold; font-size: 13px;border:none}
.paginator a:hover {color: #fff; background: #ffa501;border-color:#ffa501;text-decoration: none;}
属性设置:CssClass="paginator" CurrentPageButtonClass="cpb" PagingButtonSpacing="0"
迅雷风格:

CSS样式:
.pages { color: #999;overflow: auto; }
.pages a, .pages .cpb { text-decoration:none;float: left; padding: 0 5px; border: 1px solid #ddd;background: #ffff;margin:0 2px; font-size:11px; color:#000;}
.pages a:hover { background-color: #E61636; color:#fff;border:1px solid #E61636; text-decoration:none;}
.pages .cpb { font-weight: bold; color: #fff; background: #E61636; border:1px solid #E61636;}
属性设置:CssClass="pages" CurrentPageButtonClass="cpb" PagingButtonSpacing="0"
AspNetPager分页控件的使用的更多相关文章
- AspNetPager分页控件
AspNetPager分页控件解决了分页中的很多问题,直接采用该控件进行分页处理,会将繁琐的分页工作变得简单化,下面是我如何使用AspNetPager控件进行分页处理的详细代码:1.首先到www.we ...
- 【转】AspNetPager分页控件用法
AspNetPager分页控件解决了分页中的很多问题,直接采用该控件进行分页处理,会将繁琐的分页工作变得简单化,下面是我如何使用AspNetPager控件进行分页处理的详细代码: 1.首先到www.w ...
- 给AspNetPager分页控件添加bootstrap样式
AspNetPager分页控件算是比较好用的一个分页控件了.想要结合bootstrap使用,官方代码入口 .pagination a[disabled]{ color: #777;cursor: no ...
- PagedDataSource数据绑定控件和AspNetPager分页控件结合使用列表分页
1.引用AspNetPager.dll. 2.放置Repeater数据绑定控件. <asp:Repeater ID="Repeater1" runat="serve ...
- AspNetPager分页控件配置
AspNetPager是asp.net中常用的分页控件,下载AspNetPager.dll,添加引用,在工具栏就可以看到AspNetPager控件: 拖过来之后,设置如下属性: <webdiye ...
- AspNetPager分页控件使用方法
一.下载AspNetPager.dll 二.AspNetPager.dll复制于应用程序下的bin目录,打开解决方案,引用dll文件 三. 在工具栏中添加控件,这样可以支持拖拽使用 四. 要使用Asp ...
- AspNetPager分页控件的使用方法
1. 首先将AspNetPager.dll复制于应用程序下的bin目录,打开解决方案,引入dll文件 (通过NuGet获取) 2. 在工具栏中添加控件,这样可以支持拖拽使用 3.页面拖入分页控件,设置 ...
- AspNetPager分页控件样式的使用
分页是Web应用程序中最常用到的功能之一,AspNetPager 简单实用,应用到项目后台中,棒极了! 自定义样式: <style type="text/css"> ...
- AspNetPager分页控件官方网站
原文发布时间为:2009-12-04 -- 来源于本人的百度文章 [由搬家工具导入] http://www.webdiyer.com/AspNetPager
随机推荐
- UVA1637Double Patience(概率 + 记忆化搜索)
训练指南P327 题意:36张牌分成9堆, 每堆4张牌.每次拿走某两堆顶部的牌,但需要点数相同.如果出现多种拿法则等概率的随机拿. 如果最后拿完所有的牌则游戏成功,求成功的概率. 开个9维数组表示每一 ...
- pip apt source images
~/.pip/pip.conf [global] index-url = https://pypi.douban.com/simple download_cache = ~/.cache/pip [i ...
- css 实现悬浮效果
<!DOCTYPE html><html><head> <meta charset="UTF-8"> <title&g ...
- UITextField set placeholderColor and UITextField set clearButton Image
self.usernameTextField.tintColor = [UIColor whiteColor]; [self.usernameTextField setValue:UIColorFro ...
- Spring Boot整合Dubbo框架demo
Dubbo框架原理见之前的博文:http://www.cnblogs.com/umgsai/p/5836925.html 首先启动zookeeper Server端 Pom配置如下 <?xml ...
- MySQL练习-employees数据库(二)
department 部门表 dept_emp 部门员工任职期表(按部门&时期) dept_manager 部门经理任职期表(按时期) employees 员工详情表 salaries 员工薪 ...
- 遍历Map的方法
1.使用 entrySet() entrySet() --> 官方推荐将Map转换成Map.Entry对象的Set集合 Set entrys = map.entrySet(); Iterat ...
- 个人对RCU的理解
本文对于RCU的概念不进行解释. 考虑一种比较让人困惑的情形,就是在grace period期间,有新的读者进入,那么这个读者拿到的是新数据还是旧数据,查阅了很多资料都没找到答案,当然对于链表的情况这 ...
- redis的一些操作
public class WnsRedisFactory { private static Cache pool = null; private static JedisConnectionFacto ...
- (转)winform(C#)里几种弹出对话框
//消息框中需要显示哪些按钮,此处显示“确定”和“取消” MessageBoxButtons messButton = MessageBoxButtons.OKCancel; //"确定要退 ...