posted 20 years ago
Gautam,
For achieving this, either you can fire a query to db everytime user clicks on next or previous button or fetch all of them in memory (in array or some other datastructure which maintains sequence) at one go as that would be faster.
But again that depends upon the no if records you are expecting in db which are going to be fetched.
You'll have to keep flags to check whether user has clicked on previous or next and manipulate data accordingly.
Also, you'll have to maintain counters to find out the starting no. and no of records displyed.
e.g if you are displaying 26-50 records then your starting counter will be 26, no of records displayed will be 25 and say if user clicked on next, u would know that you have to show 51-75 (26+25) - (50+25) records.
Hope this helps.
Thanks