Nice Page Number Navigation for Recordsets

John Avis by | October 3, 2007 | Classic ASP

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

Classic ASP

Sending email using Amazon SES with Classic ASP

by John Avis | March 21, 2017

I recently needed to change a client's website to send emails using Amazon SES and encountered a few issues.

Classic ASP

Classic ASP class constructors with parameters

by John Avis | June 8, 2016

Although probably no one cares about Classic ASP, except those who still need to support it, I was refreshing my memory today on how to use classes in Classic ASP and found a couple of options for simulating constructors with parameters.

Classic ASP

Classic ASP cookie with no name hacking attack causing error 80004005

by John Avis | July 31, 2015

As of July 2015, many of my Classic ASP websites have started logging strange errors, either 80004005 or not reporting any error code at all.


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

Leave a Comment
ASP.NET Html Forms ASP.NET MVC ASP.NET Web Forms ASP.NET Web Pages Bootstrap C# Classic ASP Cool Websites Databases eBay and PayPal Electrical Repairs General Hardware HTML/CSS Jquery/Javascript Media Center Mobile Phones Responsive Web Design SEO and Social Networking Web Design Web Development Web Security web+db Website Hosting Windows XP Youtube

About me

...mostly about web development and programming, with a little bit of anything else related to the Internet, computers and technology.


Get the latest posts delivered to your inbox.