Solved

Google-like recorset paging

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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

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…
Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

785 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