Wayne Molina
Wayne Molina

Reputation: 19586

How to do effective paging in Classic ASP?

I'm trying to page a table, and while I have paging already working, it displays every page in a single line along with Previous/Next links, causing the HTML page to break if there are a lot of results (which often there are).

What I'd like to do is display the pages in batches of 10, e.g. 1...10, if you're on page 10 and click "Next" then it changes to 11-20, and so on. How should I go about doing this?

Upvotes: 1

Views: 8170

Answers (3)

Michal
Michal

Reputation: 3169

Wayne I would recommend you have a look at ajaxed asp library. It is a still active classic ASP project which provides generic paging (for all kind of data structures) and also uses the paging mechanism within its Datatable control.

That control easily allows you to create a table with just a SQL Query. Similar to asp.net's Datagrid. Fully AJAX as well.

Check the datatable examples and you will see the batch paging and more... everything fully configureable.

Supported DBs are MySQL, sqlite, MS Access, MS Sqlserver, Oracle

Upvotes: 4

cdeszaq
cdeszaq

Reputation: 31280

One solution would be to let the client-side do the paging. If the table is not too horribly long, this would work quite well. We use the following jQuery plugin: http://sprymedia.co.uk/dataTables/example_multiple_tables.html

Upvotes: 0

Tiago
Tiago

Reputation: 9557

If you were using MySQL, you can do the pagination right in the sql, something like this:

SELECT ...
FROM
WHERE
LIMIT pagenum*pagesize, (pagenum+1)*pagesize 

edited: I first thought that the above sql was for sqlserver.

Upvotes: -1

Related Questions