Solved

Google-like recorset paging

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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

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…
I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
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, fr…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

706 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

16 Experts available now in Live!

Get 1:1 Help Now