I built a page that uses the ASP.NET AJAX UpdatePanel and within it I placed a GridView control that connects to a DataSet (that uses TableAdapers to a SQL Server 2005 database back end) using a DataSource control. I do not use paging in the GridView so that the user can print all of the items in the grid. I noticed that when there are a lot of items in the grid, about 25 or more, the load of the UpdatePanel became very slow. I figured it was my virtual machine, but this even happened on our production server and users even commented on it.
I did the normal things like checked the queries and even looked at the page tracing to determine what controls might be causing the issue. I could not find where the slowdown was coming from. Then, just to try it, I moved the DataSource control for the GridView out of the UpdatePanel. Low and behold the update sped up around 300% – 400%!
My only guess is when the DataSource control was being recreated every time the UpdatePanel was loaded and this just takes time. So now as part of my common practice, I put all DataSource controls at the bottom of the page. It would be nice if the designer did this automatically.
Tip Submitted By: David McCarter