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第三方类库text-encoding
SQL SERVER数据库权限分配
天地图显示不全
运用shapefile.js解析Shp文件
基于Nginx搭建RTMP/HLS视频直播服务器
centos pptp客户端 连接服务端
zabbix如何配置微信报警
zabbix使用web界面设置邮件报警
linux系统如何查看某一进程的启动时间
cobbler自动化安装Linux系统
原文地址:https://www.cnblogs.com/yangbin1005/p/985768.html
最新文章
查看使用某端口的进程 关闭端口
kafaka
Java自学基础、进阶、项目实战网站推荐
Dubbo架构
Spring 官方文档笔记---Bean
链表中环的入口结点
一文然你对实例部类与静态内部类有更深的了解
java自学基础、项目实战网站推荐
Arrays.asList()方法注意事项
Infinity、-Infinity和NaN
热门文章
子类与父类中静态代码块、匿名代码块、构造器的执行顺序
配置多个JDK存在的问题与解决方案 (亲测可用)
学习使用SignalR
influxdb数据库的安装部署(windows)二
VMwareTools
VS Code环境配置
SQL Server链接服务器信息查询
值比较
.NET Reflector软件破解
js 时间字符串转化为时间
Copyright © 2011-2022 走看看