Solved

Google-like recorset paging

Posted on 2004-03-23
3
193 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 150 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

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…
I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:  The Exchange of information …
Internet Business Fax to Email Made Easy - With  eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, f…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

863 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now