zoukankan
html css js c++ java
分页逻辑
int
pageIndex
=
1
;
//
当前页码
int
id
=
Convert.ToInt32(Request.QueryString[
"
id
"
]);
//
专题ID
int
totalCount
=
new
articleOP().getArticleCountByClass(id);
//
专题内的文章数量
int
totlePage
=
totalCount
/
1
;
//
总页数
if
(totlePage
==
0
)
{
totlePage
=
1
;
}
if
(Request.QueryString[
"
page
"
]
!=
null
)
{
pageIndex
=
Convert.ToInt32(Request.QueryString[
"
page
"
]);
}
this
.dlArticleLList.DataSource
=
new
articleOP().getArticleByClass(id, pageIndex);
this
.dlArticleLList.DataBind();
this
.lblCurrentPage.Text
=
pageIndex.ToString();
this
.lblTotalPage.Text
=
totlePage.ToString();
this
.lblTotalCount.Text
=
totalCount.ToString();
if
((pageIndex
-
1
)
*
1
+
this
.dlArticleLList.Items.Count
<
totalCount)
//
如果当前页的记录数加上前面所有页的记录数>总记录数,则禁用“下一页”
{
this
.hpNext.Enabled
=
true
;
}
else
{
this
.hpNext.Enabled
=
false
;
}
if
(pageIndex
<=
1
)
//
如果是第一页 ,则禁用首页及上一页
{
this
.hpFirstPage.Enabled
=
false
;
this
.hpPre.Enabled
=
false
;
this
.hpNext.NavigateUrl
=
"
~/article/class.aspx?id=
"
+
id
+
"
&page=
"
+
(pageIndex
+
1
);
}
else
{
this
.hpFirstPage.Enabled
=
true
;
this
.hpPre.Enabled
=
true
;
this
.hpFirstPage.NavigateUrl
=
"
~/article/class.aspx?id=
"
+
id
+
"
&page=1
"
;
//
首页page = 1
this
.hpPre.NavigateUrl
=
"
~/article/class.aspx?id=
"
+
id
+
"
&page=
"
+
(pageIndex
-
1
);
//
上一页
this
.hpNext.NavigateUrl
=
"
~/article/class.aspx?id=
"
+
id
+
"
&page=
"
+
(pageIndex
+
1
);
//
下一页
this
.hpLast.NavigateUrl
=
"
~/article/class.aspx?id=
"
+
id
+
"
&page=
"
+
totlePage;
//
最后一页
}
查看全文
相关阅读:
CentOS6 破解登录密码
CentOS 添加硬盘创建并挂载分区
CentOS 安装开发工具包
CentOS vim的使用
CentOS tcpdump的使用实例
CentOS7没有ifconfig/route/arp/netstat等命令的解决方案
CentOS 查看系统 CPU 个数、核心数、线程数
Linux系统中的load average
Python基础-shelve模块
Python基础-configparser和hashlib模块
原文地址:https://www.cnblogs.com/yangbin1005/p/985768.html
最新文章
【Spark调优】Kryo序列化
【Spark调优】内存模型与参数调优
【Spark调优】Shuffle原理理解与参数调优
【Spark调优】数据本地化与参数调优
【Spark调优】:结合业务场景,优选高性能算子
【Spark调优】:如果实在要shuffle,使用map侧预聚合的算子
【Spark调优】:尽量避免使用shuffle类算子
【Spark工作原理】stage划分原理理解
【Spark工作原理】Spark任务调度理解
搭建智能合约开发环境Remix IDE及使用
热门文章
Solidity两个string的比较
solidity如何拼接字符串?
Java String.intern的深入研究
zookeeper集群搭建及Leader选举算法源码解析
PM2怎么开启ES6?
pm2常用的命令用法介绍
Node.js http服务器搭建和发送http的get、post请求
node.js获取url中的各个参数
linux下的dd命令使用详解
CentOS7 破解登录密码
Copyright © 2011-2022 走看看