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;
//
最后一页
}
查看全文
相关阅读:
记一次css载入指定url失败
更改MySQL密码后Navicat连接失败错误代码1045
Maven项目中不显示Maven Dependenciesy依赖
Mysql导入sql文件报错1064
nexus-3.2.0-01.zip安装以及如何启动服务
JS中函数的词法作用域
关于JS中函数的返回值的一点死思考
swich语句的小练习
sublime的小技巧
RPC failed; curl 18 transfer closed with outstanding read data remaining
原文地址:https://www.cnblogs.com/yangbin1005/p/985768.html
最新文章
数据类型
JDK的安装及卸载
Markdown
Spring MVC 基础
apache 2.2安装
chapter 01
包的作用
不能使用unitTes测试原因,可能是eclipse IDE插件未安装好,以下更新插件 http://download.eclipse.org/tools/ajdt/43/update
1.SQL DDL DML
vmware克隆的linux修改mac
热门文章
银行业务系统
交通灯管理系统
代理技术
类加载器和自定义类加载器
反射
IO(三)
IO(二)
IO(一)
异常处理
在工作空间修改完文件,重新加载找不到了?
Copyright © 2011-2022 走看看