Jimmy
Jimmy

Reputation: 2915

Client side pagination on ASP.NET GridView

I have a client who wants to return an ENORMOUS query from a web service, and will not budge. They are adamant that the query must be able to return absolutely everything, and they also will not allow us to do any sort of server side paging.

We have it working so that it returns all the data just fine, and we have it displayed in an ASP.NET GridView. In order to speed up the rendering of the huge grid, we decided to implement client-side paging, but I'm not exactly sure how to go about this.

Currently, we store the whole of the data in the ViewState, and then page and sort based off of that so as to avoid hitting the server again.

However, with the default set up, when trying to select any page but the first, it returns a 404 error. I'm guessing this is because it times out while trying to send the enormous data set via the ViewState.

Is there any sort of way to return the data set, and then do all of the paging and sorting all on the client without having to do any sort of post back? Or is there some other way to do this that we haven't thought of? (besides server side paging. We would LOVE to do it this way because it is so obviously the right way, but the client won't budge...)

EDIT: I would like to stick to the ASP.NET GridView control if at all possible. We've found a couple different options like jQuery and the like, but we have a lot of things to change if we change to a different type of control. So I'd like to avoid changing that if at all possible.

Upvotes: 1

Views: 5625

Answers (3)

Robert
Robert

Reputation: 3074

I've had good luck using the jquery tablesorter plugin. It gives some great options.

http://tablesorter.com/docs/

Upvotes: 0

COLD TOLD
COLD TOLD

Reputation: 13579

If the time is not a big problem for you the time it takes to get all the records from the database and I believe that on the client side the grid is typically renders as an HTML table than you can use a jquery plugin that will paginate the table on the client side.

http://www.codeproject.com/KB/webforms/clientside_gridviewpaging.aspx

Upvotes: 3

David
David

Reputation: 73564

We've run into situations where the Viewstate itself becomes a performance issue, and had to come up with ways to address a similar situation...

Your options depend greatly on some details which aren't included in the question.

For example? How often does the data from the webservice change? You may be able to do one of the following:

  • Save the results in Cache or Session (not a good idea if the results are that large...)
  • Serialize the result to an Xml file and read from that while paging
  • Import the data periodically into a SQL database, or into a temp table in a SQL database, with some identifier to tie the data to the user.

Upvotes: 2

Related Questions