Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1705
Set page count in WebGrid with JavaScript
posted

I have a report that could potentially have up to 1.2 million records. I have implemented custom paging and only query 500 records at the time. It all seems to work fine however the call for the first page for the very first 500 records the app takes around 1.5 min since it pulls the first 500 records from the complex query plus it also does a count(*) for the whole query (1.2 million) in order to calculate the number of pages (That's the only reason why I count all the possible rows returned).

So as you can see it executes the query (in the same stored procedure) twice for the first page.

I was thinking that  I could get the 500 records and then with javascript execute a web method and get the count asynchronously. This would involve setting the page count with javascript so the WebNav control also works (otherwise it doesn't fire a postback).

So, how can I change the paging settings on the client side?

Thanks!