Tuesday, September 13, 2011

The other benefit of PagedList

Why not do all pagination client side? Why not just get the whole of the record set from the server and then do any pagination with a jQuery widget beyond the grasp of C#? Well, the obviously reason not to do this is that the record set could be very large, tens of thousands of records in size. It will be less of a performance drag to retrieve just a piece of a record set.

But let's say you need the whole of the record set anyways. Let's say you are going to cast the records to a DataTable and append some extra columns onto the table from other database calls to other objects. Once you have the complicated DataTable in our scenario, you need to keep it because you need to be able to sort it on both the appended and original columns. The pages you will show in a paged set will be pieces of this giant table.

Once you are hip deep in this scenario, why would PagedList<T> be beneficial over jQuery-based paging? There is another thing to consider and that is the render time of the screen. If you pump tens of thousands of records into HTML and then show just a dozen of them in pagination, you will not be saved from a lag.

No comments:

Post a Comment