Nice Page Number Navigation for Recordsets

John Avis by | October 3, 2007 | Classic ASP Web Development

The following script creates links to navigate through your database table recordset.

It is a solution to displaying navigation links where the number of pages may be quite large and there may not be enough room to display all page numbers.

Sometimes it can be frustrating for users if there is only a previous and next link but they want to get to a page half way through of 50 pages.

It creates links to the surrounding pages as well as the first or last page, as well as previous and next links.

A few examples:

1 2 3 4 5 6 7 8 9 10 11 ... 100 Next

Previous 1 ... 6 7 8 9 10 11 12 13 14 15 16 ... 100 Next

Previous 1 ... 90 91 92 93 94 95 96 97 98 99 100

The following variables and objects are used and may need to be changed for your application.

'lngPage' is the current page number and this is passed in the URL parameter 'page'.
'rsTable' is the recordset.
'page.asp' should be changed to the correct script name and any additional parameters added to the querystring.

Show Sample

Related Posts

Computers & Internet Web Development Website Hosting

500 Internal Server Error after migrating from IIS 7.5 to IIS 10

by John Avis | November 4, 2019

As support ends for Microsoft Windows Server 2008 I have recently gone through migrating some websites to a new server running Windows Server 2016 and IIS 10 but some of the websites did not work.

Jquery/Javascript Web Development

tagInput: A simple jQuery plugin for tag entry using Bootstrap 4

by John Avis | October 15, 2019

For a website project I needed a way to enter multiple tags. I just wanted something simple that I could easily modify to suit my own needs, so I wrote my own.

ASP.NET Web Forms Web Development

ASP.NET bug with RadioButton GroupName in Repeater

by John Avis | September 1, 2019

I rediscovered a bug in ASP.NET that affects RadioButtons inside repeaters. Here is my solution to the problem.


There are no comments yet. Be the first to leave a comment!

Leave a Comment


About me

...random postings about web development and programming, Internet, computers, electronics and automotive topics.


Get the latest posts delivered to your inbox.