Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Google-like recorset paging

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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
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.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

840 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