locked
PostBackTrigger and UpdateProgress RRS feed

  • Question

  • User-207518206 posted

    hi everybody,

    i'm having problems with updateprogress, i'm using a Postbacktrigger to load my excel file. I tried Asyncpostback but the file upload doesn't work with that. Everythings works fine except for updateprogress. (I know it can't work with PostbackTrigger.. but i absolutely need it, cause my file is huge and it takes a long time to load. I can't use a fixed timeout). Now i'm trying to start updateprogress onclientclick but.. i don't know how to stop it! I would stop it when file upload ends. Any ideas? THANK YOU!!!!

    this is what i'm using to start Updateprogress:

    <asp:UpdatePanel runat="server" ID="updButton" >
    <ContentTemplate>
    <asp:ImageButton runat="server" ID="provaexcel" ImageUrl="~/Images/ImmagineExcel.png"
    OnClick="provaexcel_Click" OnClientClick="postbackButtonClick()" />
    </ContentTemplate>
    <Triggers>
    <asp:PostBackTrigger ControlID="provaexcel" />
    </Triggers>

    </asp:UpdatePanel>


    function postbackButtonClick() {
    updateProgress = $find("<%= UpdateProgress15.ClientID %>");
    window.setTimeout("updateProgress.set_visible(true)", updateProgress.get_displayAfter());
    return true;
    }


    <asp:UpdatePanel runat="server" ID="provaupd15">
    <ContentTemplate>

    <div class="indicator" id="divclassProgress15" runat="server">
    <asp:UpdateProgress ID="UpdateProgress15" runat="server" AssociatedUpdatePanelID="updButton"
    DisplayAfter="0" DynamicLayout="true">
    <ProgressTemplate>
    <table class="loading">
    <tbody>
    <tr>
    <td>

    <asp:Image runat="server" ID="Comm_ind12" ImageUrl="~/App_themes/common/background/indicator.gif" />
    <asp:Label CssClass="label" ID="Comm_porgress12" runat="server">
    Attendere prego ......
    </asp:Label>
    </td>
    </tr>
    </tbody>
    </table>
    </ProgressTemplate>

    </asp:UpdateProgress>
    </div>

    </ContentTemplate>
    </asp:UpdatePanel>

    Friday, January 20, 2017 11:30 AM

All replies

  • User-207518206 posted

    sorry, i forgot to say that i'm using response.end to load file: 

    Response.Clear();
    Response.ClearContent();
    Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
    Response.AddHeader(
    "content-disposition", String.Format(System.Globalization.CultureInfo.InvariantCulture, "attachment; filename={0}", fileName));
    Response.BinaryWrite(bytes);

    this.provaupd15.Visible = false;
    this.divclassProgress15.Visible = false;

    Response.Flush();

    Response.End();

    Thank you

    Friday, January 20, 2017 1:11 PM
  • User-1838255255 posted

    Hi Aurora_Boreale,

    According to your description, I know you want to show loading progress when page loading data. I think jQuery Ajax is very suit to this situation, it include BeforeSend, Success, and Complete methods etc.

    You could show progress image when you call this method, then complete call and show data, progress image hide in ajaxComplete method. For more detail about these methods, please refer to this link:

    jQuery Ajax methods: 

    http://api.jquery.com/category/ajax/ 

    About this Ajax, please refer to this sample: 

    Show Loading (Busy) Indicator (Spinner) with Overlay with jQuery AJAX example:

    http://www.aspsnippets.com/Articles/Show-Loading-Busy-Indicator-Spinner-with-Overlay-with-jQuery-AJAX-example.aspx 

    Also if you want to use UpdateProgress, you could refer to this sample learn how to use:

    Display (Show) ASP.Net AJAX UpdateProgress with UpdatePanel PostBackTrigger:

    http://www.aspsnippets.com/Articles/Display-Show-ASPNet-AJAX-UpdateProgress-with-UpdatePanel-PostBackTrigger.aspx 

    Best Regards,

    Eric Du

    Tuesday, January 24, 2017 3:28 AM