I have an UpdateProgress AJAX spinner which works ok when any updates occur within my UpdatePanel.
However I have an export button which carries out a Response.Redirect to another page which exports a datagrid into excel.
The problem is, a dialog pops-up which says should I save the excel document, open it or cancel. If I
cancel, the dialog is dismissed but the updateprogress spinner within the originating button's updatepanel continues to spin, incorrectly giving the impression the application is busy.
I'm not a AJAX guru, but I've got a feeling the update panel isn't receiving a STOP or end request message to stop the update progress panel from showing busy.
Does anyone know how to either 1) prevent this from happening 2) explicitly send a message or something similar to the updateprogress on dismissing the Open/Save dialog??
It is not a good practice to use Response.Write or server.execute from within an ASP.NET page in general. As UpdatePanels work by intercepting the page rendering process you are recieving the errors.
You can put the code to generate the data in an HTTPHandler or you can make the button a PostBackTrigger.
Because of the way updatepanels manage the DOM elements within them, you cannot use Response.Write() with them.
Chetan Sarode
Team Lead, Product Development
Approva Systems Pvt Ltd, Pune, India.
I'm not using a Response.Write, I'm using a Reponse.Redirect from the AJAX page, to another page which then calls the following code in the Render routine of the page:
You can programmatically control when an UpdateProgress control is displayed by using the JavaScript beginRequest and endRequest events of the PageRequestManager
class. In the beginRequest event handler, display the DOM element that represents the UpdateProgress control. In the endRequest event handler, hide the element.
I came across the same problem and created a simple solution.
I had a SAVE button within my UpdatePanel and used the Respose.Redirect in the associated Click event handler. This caused the UpdateProgress control to display its contents but then to not dissapear once the file had downloaded. The file downloaded was
specified by a two asp.net DropDownLists within the UpdatePanel.
Whenever the form was submitted I simply changed the onclick attributes value in the AJAX postback to the url of the page that would return the file...
Member
93 Points
592 Posts
AJAX UpdateProgress spinner won't stop!
May 27, 2008 11:24 AM|swaino|LINK
Hi,
I have an UpdateProgress AJAX spinner which works ok when any updates occur within my UpdatePanel.
However I have an export button which carries out a Response.Redirect to another page which exports a datagrid into excel.
The problem is, a dialog pops-up which says should I save the excel document, open it or cancel. If I cancel, the dialog is dismissed but the updateprogress spinner within the originating button's updatepanel continues to spin, incorrectly giving the impression the application is busy.
I'm not a AJAX guru, but I've got a feeling the update panel isn't receiving a STOP or end request message to stop the update progress panel from showing busy.
Does anyone know how to either 1) prevent this from happening 2) explicitly send a message or something similar to the updateprogress on dismissing the Open/Save dialog??
All-Star
48393 Points
12161 Posts
Re: AJAX UpdateProgress spinner won't stop!
May 27, 2008 11:25 PM|chetan.sarode|LINK
Hi
It is not a good practice to use Response.Write or server.execute from within an ASP.NET page in general. As UpdatePanels work by intercepting the page rendering process you are recieving the errors.
You can put the code to generate the data in an HTTPHandler or you can make the button a PostBackTrigger.
Because of the way updatepanels manage the DOM elements within them, you cannot use Response.Write() with them.
Team Lead, Product Development
Approva Systems Pvt Ltd, Pune, India.
Member
93 Points
592 Posts
Re: AJAX UpdateProgress spinner won't stop!
May 28, 2008 04:13 AM|swaino|LINK
I'm not using a Response.Write, I'm using a Reponse.Redirect from the AJAX page, to another page which then calls the following code in the Render routine of the page:
Response.ContentType = "application/ms-excel"
Response.ContentEncoding = System.Text.Encoding.UTF8
Response.AddHeader("Content-Disposition", "inline;filename=xport.xls")
If I cancel the dialog to Open/Save, I'm back to the AJAX page with the UpdateProgress spinner showing activity.
How can I prevent the UpdateProgress/AJAX spinner from doing this?
All-Star
35458 Points
3430 Posts
Re: AJAX UpdateProgress spinner won't stop!
May 30, 2008 01:18 AM|Nai-Dong Jin - MSFT|LINK
Hi,
You can programmatically control when an UpdateProgress control is displayed by using the JavaScript beginRequest and endRequest events of the PageRequestManager class. In the beginRequest event handler, display the DOM element that represents the UpdateProgress control. In the endRequest event handler, hide the element.
For more information, see:
http://www.asp.net/AJAX/Documentation/Live/overview/UpdateProgressOverview.aspx
Thanks.
None
0 Points
1 Post
Re: AJAX UpdateProgress spinner won't stop!
Nov 28, 2009 10:58 AM|ONLINE SUPERTRAMP|LINK
Hi everyone,
I came across the same problem and created a simple solution.
I had a SAVE button within my UpdatePanel and used the Respose.Redirect in the associated Click event handler. This caused the UpdateProgress control to display its contents but then to not dissapear once the file had downloaded. The file downloaded was specified by a two asp.net DropDownLists within the UpdatePanel.
Solution:
I removed the asp.net button...
<asp:ImageButton ID="ImageButtonSave" runat="server" ImageUrl="~/images/Save.png" OnClick="ImageButtonSave_Click" />
and replaced it with..
<img id="ImageButtonSave" src="images/Save.png" style="cursor:hand;" runat="server" onclick="" />
Whenever the form was submitted I simply changed the onclick attributes value in the AJAX postback to the url of the page that would return the file...
//C#
protected void Search()
{
ImageButtonSave.Attributes["onclick"] = "window.location='DownloadTextFile.aspx?YEAR=" + DropDownListSearchYear.SelectedItem.Value + "&MONTH=" + DropDownListSearchMonth.SelectedItem.Value + "';";
}
This worked a treat and caused the UpdateProgress control to not show anything at all.
It's amazing how a little bit of javascript can go a long way.
Hope this helps anyone else who comes across this issue.
UpdateProgress will not dissapear after file download