Paging in VBScript

Creating a paging class was probably one of the more challenging pieces logic that I’ve ever had to create. I had a very difficult time stabilizing it, and make sure that it would reliably return the results I needed.

Well, after many hours of work, I got it to work quite well, and the fruits of my labour are for you to behold and possess!

You will note that you will require to get a recordset from the database to populate the class on your own. The class is well documented, but if you have any questions, please don’t hesitate to message me here on this blog.

You can download a copy of my paging class here. Also, don’t forget to also download a copy of the CSS that goes with it. Change it how you see fit.


The paging class does not control your recordset directly. It simply provides a user interface and will resolve what you provide it. The class requires that you provide a querystring parameter called “offset” in your URL. If you want to show the user a 10 records from 60 to 69 from a set of 100, then you’d set the offset parameter to “offset=6″.

Note that you must pass the total number of records (rowsLength) to the instance of the class before calling the page method.


[sourcecode language=”vbnet”]
Dim page
Set page = New Paging

page.RowsLength = 208 ‘Note that this is manditory before calling the WritePaging method.

Set page = Nothing

You will have to control your recordset yourself. If you have a stored procedure that requires you to provide it input on which 10 records you wish to extract from a particular recordset of 100, then you could extra that number from the querystring itself. I created a stored procedure myself that will take the offset number and provide me with 10 records withing that range. So if my offset is set at 5 (offset=5), then my stored procedure will take that number 5 and return me 10 records ranging from 50 to 59.

If you enjoyed this post, please consider leaving a comment or subscribing to the RSS feed to have future articles delivered to your feed reader.

About the Author: Jason Beaudoin

I’m a web developer from Ottawa, Ontario, Canada. My specialty is in JavaScript frameworks, and my current favorite is Mootools. I work for the Canadian army as a web developer, and I have a few other projects on the side that keep me busy including this blog.

3 Comments + Add Comment

  • Hi,

    My question is How do I call the paging class from my page. Is there any function where I have to pass the recordset name? Please tell me the way to call the paging class.

    Thanks in advance

    • Hi.

      After reading my original post, I realized that I didn’t really provide any usage notes to the post, making it near impossible to understand how it works. I will revise the post to correct this.

  • LUV your Featured Image for this article!

Leave a comment