问答文章1 问答文章501 问答文章1001 问答文章1501 问答文章2001 问答文章2501 问答文章3001 问答文章3501 问答文章4001 问答文章4501 问答文章5001 问答文章5501 问答文章6001 问答文章6501 问答文章7001 问答文章7501 问答文章8001 问答文章8501 问答文章9001 问答文章9501

asp如何让他分页显示?.每页显示10行

发布网友 发布时间:2024-09-26 21:47

我来回答

2个回答

热心网友 时间:2024-10-28 16:25

直接改好就算了
下面给你贴段分页的代码你参考一下
这个是我刚写的一个系统的管理后台的分页显示管理
自己研究才有进步

说明 注意那个PAGE是分页的页码
conn.asp是一个数据库连接文件
<!--#include file="conn.asp"-->

<%
Page=Request.QueryString("Page")
if Int(Page)="" or int(page)<1 then
currentPage=1
else
currentPage=cint(Page)
end if
set rs=server.createobject("adodb.recordset")
sql="select * from tbl_article order by exacttime desc"
rs.open sql,conn,1,1
if rs.eof and rs.bof then
rseof=1
else
rseof=2
MaxPerPage=23
PageUrl="admin_art_mnr.asp"
totalPut=rs.recordcount
if currentpage<1 then currentpage=1
if (currentpage-1)*MaxPerPage>totalput then
if (totalPut mod MaxPerPage)=0 then
currentpage= totalPut \ MaxPerPage
else
currentpage= totalPut \ MaxPerPage + 1
end if
end if
end if
%>

<%
sub showContent
i=0

%>

<%
do while not rs.eof
%>
<tr>
<td width="30" align="center" class="table00"><%=rs("id")%></td>
<td width="340" align="center" class="table00"><a href="../showarticle.asp?id=<%=rs("id")%>" target="_blank"><% if len(rs("title"))<26 then %><%=rs("title")%><%else%><%=left(rs("title"),25)&"..."%><%end if%></a></td>
<td width="99" align="center" class="table00"><%=rs("username")%></td>
<td width="80" align="center" class="table00"><%=rs("time")%></td>
<td width="100" align="center" class="table00"><a href="article_edit.asp?id=<%=rs("id")%>" class="STYLE3">编</a>|<a href="article_del.asp?id=<%=rs("id")%>"><span class="STYLE4">删</span></a>|?</td>
</tr>

<%
i=i+1
if i>=MaxPerPage then exit do
rs.movenext
loop
end sub

function showpage(totalnumber,maxperpage,filename)
if totalnumber mod maxperpage=0 then
n= totalnumber \ maxperpage
else
n= totalnumber \ maxperpage+1
end if
%>
<div align="right">共<font color="#ff0000"><b><%=totalnumber%></b></font>篇文章
<%if CurrentPage<2 then%>
 首页 上一页 
<%else%>
 <a href="<%=filename%>?page=1">首页</a> 
<a href="<%=filename%>?page=<%=CurrentPage-1%>">上一页</a> 
<%
end if
if n-currentpage<1 then
%>
下一页 末页
<%else%>
<a href="<%=filename%>?page=<%=CurrentPage+1%>">下一页</a>
<a href="<%=filename%>?page=<%=n%>">末页</a>
<%end if%>
 页次:<strong><font color="#ff0000"><%=CurrentPage%>/<%=n%></font></strong>页
</div>
<%
end function
%>

<html>
<head>
<title>控制面板</title>
<link href="style.css" rel="stylesheet" type="text/css" />
<style type="text/css">
<!--
.STYLE2 {
color: #215DC6;
font-weight: bold;
font-size: 14px;
}
#tb1 {
border: 1px solid #0000FF;
padding: 1px;
font-family: "宋体", Arial;
font-size: 12px;
margin: 1px;
}
.STYLE3 {color: #FF6600}
.STYLE4 {color: #FF0000}
-->
</style>
</head>
<body><table align="center" width="100%" border="0">
<tr align="center">
<td height="80" align="center"><br>
<br>
<br>
<span class="STYLE2">文章管理中心</span><br>
<table width="671" id=tb1>
<tr>
<td width="30" align="center" id=tb1>ID</td>
<td width="340" align="center" id=tb1>标题</td>
<td width="99" align="center" id=tb1>作者 </td>
<td width="80" align="center" id=tb1>时间 </td>
<td width="100" align="center" id=tb1>管理项目 </td>
</tr>
</table>
<table width="671" border="0" id=tb1>
<%
if rseof=1 then
%>
<tr>
<td align="center" class="table00">没有任何文章</td>
</tr>

<%
else
if currentPage=1 then
showContent

else
if (currentPage-1)*MaxPerPage<totalPut then
rs.move (currentPage-1)*MaxPerPage
dim bookmark
bookmark=rs.bookmark
showContent

else
currentPage=1
showContent

end if
end if
end if
%>
<% if rseof<>1 then
%>
<tr>
<td align="right" class="table00" colspan="5">
<%
showpage totalput,MaxPerPage,PageUrl
%>
</td>
</tr>
<%
end if
%>
</table>

</td>
</tr>
</table>
</body>
</html>

热心网友 时间:2024-10-28 16:25

ASP.NET 2.0中的页面输出缓存

参考资料:http://dotnet.chinaitlab.com/ASPNET/395231.html

声明声明:本网页内容为用户发布,旨在传播知识,不代表本网认同其观点,若有侵权等问题请及时与本网联系,我们将在第一时间删除处理。E-MAIL:11247931@qq.com
世界气象组织对地面气象观测站的分布和类型有何统计? 气象仪器土壤温度 电脑为什么会出现一个小对话框然后黑屏? ...会出现黑屏 然后出现一个英文框 然后黑屏一下 在恢复 这是为什么... 我玩电脑游戏时 突然黑屏了然后出现了一个框里面有一句英语翻译后是输... ...玩英雄连好像改了屏幕大小,然后突然黑屏,出现个框在满屏幕走框里说... 今天在玩游戏时从桌面切入游戏时突然黑屏,然后出现这种对话框,到底是... ...刚进游戏就黑屏,然后弹出这样一个框(如图),哪位大神知道该怎么解决... 江苏海事职业技术学院宿舍费用为什么涨价 刘邦儿子除了刘盈和刘恒外 其他儿子又是什么下场 为什么电脑插耳机没有声音???!!! 电脑耳机没声音了怎么办? AspNetPager能分页,但无法点击下一页,显示有3页的数据,可点下一页... 如何在iPhone上取消对电脑的信任设置? 如何在iPhone上撤销对电脑的信任设置? 长在泥土外面的青土豆真的有毒不能吃吗? 能快速提高成绩的方法 孩子成绩不好家长怎么引导 我也想成为coser怎么才可以啊 怎样成为一名优秀的coser 加入了一个cosplay的社团、、想要问下、、做妆娘需要具备什么条件... 如何成为一名好的妆娘或妆爷呢 好得睐方便菜价格贵不贵? 为什么大多的人都要选择好得睐方便菜。 好得睐方便菜好吃吗 庭院栽什么植物最旺宅 淘宝宝贝怎么增加规格?宝贝分类怎么弄? 请问一下,梦见开车在路上跑,好像天要倒了一样压过来,这是什么意思... 苹果手机如何清除抖音缓存 数控仿真数控仿真-FANUC 数控车床的仿真操作 房屋租赁需要哪些证件 耳机在电脑上没声音怎么回事? 什么茶去湿气效果较好 ...那么积增加28;如果一个因数不变,另一个因数减少6 ...如果一个因数不变,另一个因数减少4,积就减少200 苹果手表语朗读关闭不成功 企业级SSD真的能闭眼买吗? 天然气软管是否必须使用不锈钢波纹管 方和阮组合的好名字 倍他羟基芬太尼简介 农历1966年9月14日是新历多少 倍他乐克的功效与副作用 全民水浒阮氏三雄组合怎么样介绍_全民水浒阮氏三雄组合怎么样是什么... 倍他米松简介 儿啊,妈妈在家等你! 迪宝老人机怎样取消耳机 ...中用函数粘贴的方法计算出及格、优秀、不及格人数,该怎样操作?_百度... 大堡礁自由行攻略有哪些好推荐? 写出与春夏秋冬的句子 秋天的朋友圈说说 幼儿睡眠障碍有哪些情况发生?