UpdateProgress ASP.NET C # does not close

2

I have a page in which I have an ImageButton that generates an excel with a report.
The problem is that by clicking on the button the UpdateProgres is executed but it never finishes executing, although the excel is generated and I can download it without any problem, if later I want to continue interacting with the page I can not do it until the page refreshes.
I leave a view of the problem:

Code .Aspx

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<asp:UpdateProgress ID="UpdateProgress1" AssociatedUpdatePanelID="updClientes" runat="server" DisplayAfter="0">
    <ProgressTemplate>
        <div id="blur" class="ProgressIndicatorFondoModal">&nbsp;</div>
        <div class="ProgressIndicator">
            Procesando <asp:Image ID="Image1" runat="server" Height="16px" Width="16px" ImageUrl="~/Imagenes/ajax-loader.gif" />
        </div>
    </ProgressTemplate>
</asp:UpdateProgress>
<asp:UpdatePanel ID="updClientes" runat="server">
    <ContentTemplate>
        <br />
        <asp:Accordion ID="accFiltros" runat="server" FadeTransitions="True" FramesPerSecond="40" Width="100%"
                    TransitionDuration="200" RequireOpenedPane="false" SuppressHeaderPostbacks="true" HeaderCssClass="accordionHeader"
                     ContentCssClass="accordionContent" HeaderSelectedCssClass="accordionHeader_selected">
            <Panes>
                <asp:AccordionPane ID="accPaneFiltros" runat="server">
                    <Header>
                        <div class="accordionTitulo">
                            <span class="TituloFiltros" id="TituloFiltros">
                                <asp:Literal ID="Literal1" runat="server" Text="<%$ Resources:GD, TituloFiltrosClientes%>"></asp:Literal></span> - Filtros de Búsqueda 
                        </div>
                    </Header>
                    <Content>
                        //Código del panel para filtrar datos
                    </Content>
                </asp:AccordionPane>
            </Panes>
        </asp:Accordion>
        <div style="position: relative; float: left; padding: 5px; border: 1px;">
            <asp:Button ID="btnLimpiar" Text="<%$ Resources:GD, btnLimpiar %>" ToolTip="<%$ Resources:GD, btnLimpiarToolTip %>" runat="server" Width="100px" CssClass="boton" OnClick="btnLimpiar_Click" />
        </div>
        <div style="position: relative; float: right; padding: 5px; border: 1px;">
            <asp:Button ID="btnNuevoCliente" runat="server" CssClass="boton" Text="<%$ Resources:GD, btnNuevoCliente %>" ToolTip="<%$ Resources:GD, btnNuevoClienteToolTip %>" OnClick="btnNuevoCliente_Click" />
        </div>
        <div style="position: relative; float: left; padding: 5px; border: 1px; margin-top: 35px;">
            <asp:Label ID="lblMensaje" runat="server" CssClass="MensajeError"></asp:Label>
        </div>
        <div id="divGrilla1" runat="server" style="overflow: auto; margin-top: 45px">
            <div id="div1" runat="server" style="position: relative; float: left; margin-top: 20px">
                <asp:Label ID="lblCantResultados" runat="server" CssClass="label" Style="font-weight: bold"></asp:Label>
                <asp:Label ID="lblMenResultados" runat="server" CssClass="label"></asp:Label>
            </div>
            <div style="position:relative; float: right;"> 
                <asp:UpdatePanel runat="server" ID="updBtnExcel">
                    <ContentTemplate>
                        <asp:ImageButton ID="btnExcelClientesListar" ToolTip="<%$ Resources:GD, btnExcelToolTip %>" runat="server" ImageUrl="~/Imagenes/botExcel.jpg" 
                                         OnClick="btnExcelClientesListar_Click" Visible="False"/>
                    </ContentTemplate>
                </asp:UpdatePanel>
            </div>
        </div>
    </ContentTemplate>
</asp:UpdatePanel>


I tried to put the ImageButton inside another UpdatePanel but it is not working, likewise the UpdateProgress is running

Aspx.cs code of the Click event

protected void btnExcelClientesListar_Click(object sender, ImageClickEventArgs e)
    {
        try
        {
            if (Session["DatosGvClientes"] != null)
            {
                Armar_Reporte_Excel();   
            }
        }
        catch (Exception ex)
        {
            log.Error("GirosListar.aspx:btnExcelClientesListar_Click", ex);
            this.lblMensaje.Text = Resources.GD.msgErrorGenerico;
        }
    }

Data: I have another page with the same code in which I do not have this problem.

    
asked by Pablo Matias 31.05.2018 в 18:05
source

1 answer

2

I found the solution using PostBackTrigger :

<asp:UpdatePanel runat="server" ID="updBtnExcel">
      <ContentTemplate>
             <asp:ImageButton ID="btnExcelClientesListar" ToolTip="<%$ Resources:GD, btnExcelToolTip %>" runat="server" ImageUrl="~/Imagenes/botExcel.jpg" 
                            OnClick="btnExcelClientesListar_Click" Visible="False"/>
      </ContentTemplate>
      <Triggers>
             <asp:PostBackTrigger ControlID="btnExcelClientesListar"/>
      </Triggers>
</asp:UpdatePanel>  

This completes the UpdateProgress and you can continue browsing the page.

    
answered by 31.05.2018 / 22:23
source