When you export a grid with a lage amount of data, you might want to show the ASPxLoadingPanel during exporting. Generally, it is possible to show the LoadingPanel when you start the exporting process. However, you will not be able to determine the moment when it should be hidden, since none of events are generated at the client side when the exporting result is shown...
This example illustrates how to overcome this limit by using the asp:UpdatePanel. To get the desired result, we've used the Sys.WebForms.PageRequestManager Class. The Sys.WebForms.PageRequestManager endRequest event is raised after an asynchronous postback is finished and the control has been returned to the browser. Therefore, it is possible to hide the LoadingPanel in the endRequest event handler. However, when an export button inside the asp:UpdatePane is being clicked, its postback is transformed in an ajax callback. The problem is that when you use ajax you can't continue using the Response.Write, because Ajax doesn't write the entire page, but only some of its parts. So, it is necessary to keep data exported to a stream in the Session. Then you can send a postback to the server side and show the save dialog without ajax.
Note: If ASPxGridView exports data for more than 90 seconds, it is necessary to increase the value of the ScriptManager.AsyncPostBackTimeout property. This allows you to avoid the "The server request timed out" error during export.
See Also:
How to use the ASPxLoadingPanel as a progress indicator for AJAX UpdatePanel
GridView - How to show LoadingPanel during export
Example Comments
Added By: Don Krasnick at: 4/8/2013 12:26:36 PM
Is there a way to do this in MVC? I get a Javascript error "Sys is not defined", presumably because this is part of ASPx controls and isn't normally available in an MVC solution.
Added By: Don Krasnick at: 4/8/2013 12:35:29 PMI'm actually looking for any MVC solution for those cases when a long-running export (PDF or CSV) is on-going so that the user realizes that they have to wait a while and won't try to hit the "export" button a 2nd time - Loading panel, progres bar, etc.
Added By: Marion (DevExpress Support) at: 4/8/2013 11:22:43 PMThere is no UpdatePanel extension. So, I am afraid there is no solution for MVC.
Added By: Satheesh Kumar R Karuppusamy at: 8/13/2013 3:20:46 AMWe have implemented the same code but we are keeping Exporter in user control. and loading panel in the master page.
and after export the grid. still the loading panel not get hide.
@Satheesh Kumar,
I have opened a new thread for you. Let's continue our discussion in it:
http://www.devexpress.com/Support/Center/Question/Details/Q378619
This does not work when its in a usercontrol
Added By: Marion (DevExpress Support) at: 8/22/2013 1:55:40 AM@ Samuel,
We are going to answer your question in the context of the following thread:
http://www.devexpress.com/Support/Center/Question/Details/Q379048