Programs | pagination | scripts | static | page
<!--#include file= "conn.asp"-->
<%strHead=strHead& "strhead=strhead& "strhead=strhead& "<TITLE> pagination Test </TITLE>"
strhead=strhead& "<link href=" "Inc/style.css" "Type=text/css rel=stylesheet>"
strhead=strhead& "%>
<%
Sql= "SELECT * FROM News"
Set Rs=server.createobject ("ADODB. Recordset ")
Rs.Open sql,conn,1,1
%><%
rs.pagesize=2
Totalpage=rs.pagecount
Rs.close
Set rs=nothing
For J=1 to Totalpage
Sql= "SELECT * FROM News"
Set Rs=server.createobject ("ADODB. Recordset ")
Rs.Open sql,conn,1,1
Whichpage=j
rs.pagesize=2
Totalpage=rs.pagecount
Rs.absolutepage=whichpage
Howmanyrecs=0
%><%
Str0= ""
str0=str0& "</p>"
str0=str0& "<table bgcolor= #cecfce align=center border=0 width=800 cellpadding=2 cellspacing=1>"
%><%
Do, not rs.eof and howmanyrecs<rs.pagesize
%><%
str0=str0& "<tr bgcolor= #f7f7f7 >"
str0=str0& "<td bgcolor= #f7f7f7 align=" "Center" ">" &rs (0) & "</td>"
str0=str0& "<td bgcolor= #f7f7f7 align=" "Center" ">" &rs (1) & "</td>"
str0=str0& "<td bgcolor= #f7f7f7 align=" "Center" ">" &rs (2) & "</td>"
str0=str0& "<td bgcolor= #f7f7f7 align=" "Center" ">" &rs (3) & "</td>"
str0=str0& "</tr>"
%><%
Rs.movenext
Howmanyrecs=howmanyrecs+1
Loop
Rs.close
Set rs=nothing
%><%str0=str0& "</table>"
%><%
' Pagination section
Ref= ""
ref=ref& "<br>"
ref=ref& "<table bgcolor= #cecfce align=center border=0 width=800 cellpadding=0 cellspacing=1>"
ref=ref& "<tr bgcolor= #f7f7f7 >"
ref=ref& "<td>"
ref=ref& "<b>pages:" & J & "/" & Totalpage & "</b>"
ref=ref& "</td>"
ref=ref& "<td>"
ref=ref& "<a href=list_1.html" & ">" & "<font face=webdings>9</font>" & "</a>"
If Whichpage=1 Then
ref=ref& "<font face=webdings>7</font>"
Else
ref=ref& "<a href=list_" &j-1& "html" & ">" & "<font face=webdings>7</font>" & "</a>"
End If
For Counter=1 to Totalpage
ref=ref& "<a href=list_" &counter& ". html" & ">[" & Counter & "]</a>"
ref=ref& ""
If counter mod = 0 Then
ref=ref& "<br>"
End If
Next
if (whichpage>totalpage or whichpage=totalpage) then
ref=ref& "<font face=webdings>8</font>"
Else
ref=ref& "<a href=list_" &j+1& "html" & ">" & "<font face=webdings>8</font>" & "</a>"
End If
ref=ref& "<a href=list_" &totalpage& "html" & ">" & "<font Face=webdings>:</font > "&" </a> "
Dim fso,f
Dim Strtitle,strcontent,strout
' Create a File system object
Set fso=server.createobject ("Scripting.FileSystemObject")
Set F=fso.createtextfile (Server.MapPath ("List_" &j& ". html"), true)
' Write page content
F.writeline Strhead&str0&ref
F.close
Response.Write "Generating &j& page!<br>"
%><%
Next%>