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;
//
最后一页
}
查看全文
相关阅读:
js的解析顺序 作用域 严格模式
弹性盒模型----容器属性
tomcat解压版的配置与使用
将mysql中一行中的几个字段 转换成一列并从其他数据库中查对应的邮件信息
电脑快捷键
icell更改用户管理员
kettle下载地址
pycharm激活码
leetcode-111. 二叉树最小深度 · Tree + 递归
leetcode-102.层序遍历二叉树(正序)· BTree
原文地址:https://www.cnblogs.com/yangbin1005/p/985768.html
最新文章
Caused by: java.io.EOFException at java.io.DataInputStream.readInt(DataInputStream.java:392)
MapReduce案例:好友推荐简单实现
Yarn分布式集群环境部署
小记--------spark-job触发流程源码分析
小记--------hbase数据库预分区设计,rowkey设计及参数调优
小记--------hbase数据库java API 常用方法及案例
小记--------hbase数据库读写流程
小记--------hbase数据库各组件应用及作用
小记--------hbase数据库介绍及存储方式
小记--------sparksql和DataFrame的小小案例java、scala版本
热门文章
小记--------spark的worker原理分析及源码分析
小记--------sqoop的简单从mysql导入到hbase操作
TensorFlow多线程输入数据处理框架(三)——组合训练数据
TensorFlow多线程输入数据处理框架(二)——输入文件队列
Tensorflow多线程输入数据处理框架(一)——队列与多线程
TensorFlow图像预处理完整样例
TensorFlow图像处理函数
dbfread报错ValueError错误解决方法
原生js封装添加class,删除class
javascript的一些算法的实用小技巧
Copyright © 2011-2022 走看看