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;
//
最后一页
}
查看全文
相关阅读:
为什么要使用智能指针?
C++如何定义一个函数指针
Python三个处理excel表格的库
Python的一个mysql实例
Python利用xlutils统计excel表格数据
PHP连接数据库的方式
利用xlutils第三方库复制excel模板
Python自动化办公第三方库xlwt
Python之excel第三方库xlrd和xlwt
Python生成器
原文地址:https://www.cnblogs.com/yangbin1005/p/985768.html
最新文章
Bitmap缩放(一)
公司封装的时间控件,js脚本
前端随心记---------微信支付简述
前端随心记---------HTML5+CSS系列9.0
前端随心记---------URI 和 URL
前端随心记---------与HTTP密切相关的协议:IP,TCP,DNS
Python系列-------人工智能做什么?
前端随心记---------网络基础TCP/IP
前端随心记---------HTML5+CSS系列8.0
前端随心记---------HTML5+CSS系列7.0
热门文章
前端随心记---------HTML5+CSS系列6.0
一款免费的网页计数器----Flag counter
C++ 拷贝构造函数和赋值运算符
编译过程
C++ 基础篇
659. 分割数组为连续子序列
IO多路复用之select、poll、epoll详解
1356. 根据数字二进制下 1 的数目排序
快排与TopK 问题
1030. 距离顺序排列矩阵单元格
Copyright © 2011-2022 走看看