Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Google-like recorset paging

Posted on 2004-03-23
3
Medium Priority
?
201 Views
Last Modified: 2010-08-05
Hi again,

I want to do google like recorset paging, I have written this one , that I'm using now:

<%
            RS.CacheSize = 10
            RS.CursorLocation = adUseClient
            
            RS.Open sql, conn
            RS.PageSize = 10
Dim p
p = Request.QueryString("page")
            If Len(p) = 0  Then
                        RS.AbsolutePage = 1
                        p = 1
                  Else
                        If CInt(p) <= RS.PageCount Then
                                    RS.AbsolutePage = p
                              Else
                                    RS.AbsolutePage = 1
                        End If
            End If
            
            Dim abspage,pagecnt
                  abspage = RS.AbsolutePage
                  pagecnt = RS.PageCount

            Dim num
            Function NAV()
            Response.Write "Page&nbsp;"
                        If abspage = 1 Then
                        Response.Write ""
                        Else
                        Response.Write "<a href="""&SCRIPT_NAME&"?id="&ID&"&page=" & abspage - 1
                        If o <> "" then Response.Write "&s="&s&"&o="&o
                        Response.Write """>&laquo;</a>"
                        End If
                        
                        For num = 1 to RS.PageCount
                        If num = abspage Then
                        Response.Write "&nbsp;["& num &"]"
                        Else
                        Response.Write "<a href="""&SCRIPT_NAME&"?id="&ID&"&page="& num
                        If o <> "" then Response.Write "&s="&s&"&o="&o
                        Response.Write """>&nbsp;"& num &"</a>"
                        End If
                Next
                        
                        If abspage < pagecnt Then
                        Response.Write "<a href="""&SCRIPT_NAME&"?id="&ID&"&page=" & abspage + 1
                        If o <> "" then Response.Write "&s="&s&"&o="&o
                        Response.Write """>&nbsp;&raquo;</a>"
                Else
                        Response.Write ""
                        End If
                        End Function
                        
                Response.Write NAV()
%>

It shows like Page <1 2 3 [4] 5> of 5

How can I change it to show like :

Page 17:
<9 10 11 12 13 14 15 16 [17] 18> of 20

Page 13:
<5 6 7 8 9 10 11 12 [13] 14> of 20

etc...

<(previos page), > (next page)

Thanks!
0
Comment
Question by:N_F_S
3 Comments
 
LVL 12

Accepted Solution

by:
str_kani earned 600 total points
ID: 10694365
first count the number of pages,
then display accordingly
From the querystring you take the page id and highlight that id only..
for this,
<%
id=Querystring("pageid")

for i=1 to numberofpages
 if i=id then
    response.write ("<b>")&i
  else
    response.write (i)
next i


follow this logic you will pick up
regards,
kanni
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
Loops Section Overview

926 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question