locked
AJAX UpdateProgress spinner won't stop! RRS feed

  • Question

  • User-703432812 posted

    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??

    Tuesday, May 27, 2008 11:24 AM

Answers

  • User-1136466523 posted

    Hi,

    <?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p> </o:p>

    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.

    <o:p> </o:p>

    For more information, see:

    http://www.asp.net/AJAX/Documentation/Live/overview/UpdateProgressOverview.aspx

    <o:p> </o:p>

    Thanks.

     

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, May 30, 2008 1:18 AM

All replies

  • User555306248 posted

    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.

    Tuesday, May 27, 2008 11:25 PM
  • User-703432812 posted

    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? 

    Wednesday, May 28, 2008 4:13 AM
  • User-1136466523 posted

    Hi,

    <?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p> </o:p>

    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.

    <o:p> </o:p>

    For more information, see:

    http://www.asp.net/AJAX/Documentation/Live/overview/UpdateProgressOverview.aspx

    <o:p> </o:p>

    Thanks.

     

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, May 30, 2008 1:18 AM
  • User1953828863 posted

    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.

    Smile

    Saturday, November 28, 2009 10:58 AM