Skip to main content

Posts

Showing posts from June, 2012

Gridview Performance improvement with Custom Paging

Gridview provides excellent features to show the data on webpage. Few of the popular features are sorting, column arrangements, styles, item templates, editing, updating and deleting.
Get the data from SQL, DataList, Arrays and bind the data to Gridview and it displays the data in required format.
GridView1.DataSource = SQL command Result OR List() OR Array() GridView1.Databind();
When the data is huge and you bind the data with GridView, it can impact the performance of your page. To Overcome that, GridView Paging is provided but it fetches all the records and bind it to GridView and when you click on page number, it shows the records of that page index. GridView paging is also not good solution and hits the performance as it fetches all the records once and then bind it to GridView.
Here is the solution which do custom paging and fetches the data when required.



GridView is showing 10 records by default. Clicking on 'Next' button will show next 10 records. Clicking on 'Previous…