GridView pagination performance

750 Views Asked by At

Let's say I have a GridView with 1.000 rows. And I don't want any pagination and have all the rows visible. I can do two things:

Set AllowPaging="false" (most logical)

Or

Set AllowPaging="true" and with a higher PageSize than the total rows: PageSize="9999"

So my question is if there is any significant difference in performance between both options and if so, how do you measure something like that.

1

There are 1 best solutions below

0
On BEST ANSWER

I have been working for more than 4 years as web developer specifically asp.net developer. I have widely used datatables.net. It is very powerful,rich of features and evry easy to use.

If your gridview has 250 rows max datatable can easily digest 250 rows. I would recommed you to load 250 rows initially and when user change number of rows you can simply set option of datatable to show that many records.

Once your gridview has loaded you can apply datatable to it.Here is a little example. here is jsfiddle

You need to set 'pageLength': 25 property to decide how many records to display. initially set it to 250 after user will change the option no server side call will be sent.

And use 'lengthMenu' option to show number of records to show.

$("#tblInfo").dataTable({
            'pageLength': 25,
            'lengthMenu': [[10, 25, 50, 100, 150, 200, 250], [10, 25, 50, 100, 150, 200, 250]]
        });