How to do effective paging in Classic ASP?

烂漫一生 提交于 2019-12-06 15:53:58

问题


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?


回答1:


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




回答2:


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




回答3:


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.



来源:https://stackoverflow.com/questions/451080/how-to-do-effective-paging-in-classic-asp

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!