asp.net page freezes after gridview populates

Posted on 2011-10-12
Medium Priority
Last Modified: 2012-05-12
Hello experts,
I have some code attached that does some serious database crunching and returns about 18,000 rows into a datareader which gets bound to a gridview. That parts seems to be working ok but the page freezes and I can't do the last function, which is export to excel. I realize this page is not the best designed, but I sure could use some help. The debugger is not telling me anything useful. When I run the sql code straight through the database it takes a few minutes to run, which is about the same as the web page. And when I run smaller data sets, it works fine. Thanks.
Question by:dpicco

Expert Comment

ID: 36954386

I did not yet look at your code, but this might be more of a browser-problem, than an application-server based one.
18.000 rows seems a lot to me. Ever thought about paging? Could you try to page the data? Does that help?
In one of our applications I discovered that the Skype AddIn in conjunction with IE heavily influences performance of page-rendering an the client.
Are you using IE? If yo, do you have the Skype-Addin installed? If so, try to deactivate it.

Hope this helps you out, let me know your results,

LVL 11

Accepted Solution

madgino earned 2000 total points
ID: 36954416
There is too much data and the system can't handle it. Just do a quick test, export to excel directly from database all the record and check the excel size. Then imagine that you have to move that data from database to web server then to client and then the client to open it.

When I did this for my data I found out that I need hours for the operations and that it's normal for the browser to freeze.

One solution would be to do data filtering and allow displaying and exporting of only small/filtered chunks of data.
The other is to  redesign your application:
- for displaying do some real gridview paging using ObjectDataSource

- for exporting to excel: save it hourly/daily with a server job and redirect the user to export the pre-saved excel

Author Closing Comment

ID: 36958626
Thanks. I will be running this detailed query directly from the database and not sending it through the web server.

Featured Post

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
In real business world data are crucial and sometimes data are shared among different information systems. Hence, an agreeable file transfer protocol need to be established.
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Suggested Courses

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question