Forums
This topic is locked
Record paging
Posted 03 Jul 2003 21:05:25
1
has voted
03 Jul 2003 21:05:25 Tony Chronopoulos posted:
I started coding (vbscript) the recordset paging for my site. Basically, what I have working so far is:previous 1 2 [3] 4 5 6 7 8 9 10 11 12 13 next
Basically, what I want to add now is instead of displaying all the pages all together, I'd like to display 10 at a time and group the next 10(if available) and previous 10. Example:
-------------------------------------------------------------------------
previous 1 [2] 3 4 5 6 7 8 9 10 [11-20] next
previous [1-10] 11 12 13 [14] 15 16 17 18 19 20 [21-30] next
previous [11-20] 21 22 23 24 25 26 [27] 28 29 30 [31-36] next
previous [21-30] 31 [32] 33 34 35 36 next
-------------------------------------------------------------------------
This is some code that I'm using so far:
Dim intPageNum, intCount, ii
Dim recordsPerPage
recordsPerPage = 5
If Request("page" <> "" Then
intPageNum = CINT(Request("page")
Else
intPageNum = 1
End If
rsResult.PageSize = recordsPerPage
<%
rsResult.AbsolutePage = intPageNum
For intCount = 1 To rsResult.PageSize
%>
[html code for displaying results]
<%
rsResult.MoveNext
If rsResult.EOF Then Exit For
Next
%>
<%
'************************************************
'code for previous link
'************************************************
If intPageNum > 1 Then
Response.Write "<a class=resultsNav href=""javascript:changePage(" & intPageNum - 1 & """>Previous</a> "
Else
Response.Write "<span class=resultsNavDisabled>Previous </span>"
End If
'************************************************
'code for page numbers links
'************************************************
For ii = 1 To 10 'rsResult.PageCount
If ii = intPageNum Then
Response.Write "<span class=resultsNavSelected> [" & ii & "]</span>"
Else
Response.Write " <a class=resultsNav href=""javascript:changePage(" & ii & """>" & ii & "</a>"
End If
Next
'************************************************
'code for next page link
'************************************************
If intPageNum < rsResult.PageCount Then
Response.Write " <a class=resultsNav href=""javascript:changePage(" & intPageNum + 1 & """>Next</a> "
Else
Response.Write "<span class=resultsNavDisabled> Next</span>"
End If
%>
Aynone have any idea how to "group" the previous and next pages?
Thanks!
___________________
redtag | auto
www.redtagauto.com