Nice Page Number Navigation for Recordsets

johna 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

Web Development

How to set up a debugging using the Turnkey Linux LAMP stack and VS Code

by johna | December 19, 2023
The second part in my guide to setting up a website and database using the Turnkey Linux LAMP stack.

Website Hosting Web Development

How to set up a website and database using the Turnkey Linux LAMP stack

by johna | November 18, 2023
If you need to host your own website for the purposes of web development, Turnkey Linux LAMP Stack is an easy to install all-in-one solution that you can set up on a spare computer or a VM (Virtual Machine).

Web Development

Intermittent "Unable to read data from the transport connection: net_io_connectionclosed" errors

by johna | May 6, 2020
If you are having intermittent problems sending email in .NET using System.Net.Mail consider switching libraries.

Comments

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

Leave a Comment

About

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

I recommend ASPnix for web hosting and Crazy Domains for domain registration.

Subscribe

Get the latest posts delivered to your inbox.