none
Problema com UpdateProgress e GridView RRS feed

  • Pergunta

  • Tenho em minha WebApplication um GridView dentro de um UpdatePanel (e um UpdateProgress). Dentro do GridView tenho um ImageButton que é usado para deletar o registro. Quando clico neste botão é exibido um ModalPopupExtender. Até ai tudo funcionando. Porém, antes do ModalPopupExtender aparecer o UpdateProgress está sendo executado, e eu não quero que isso aconteça. O que devo fazer?

    Segue trecho do código:

     <div id="divTreatment" align="right" style="; z-index: inherit; top: 74px; left: 0px; width: 75%;  display: block; float: right;">  
       
            <asp:UpdatePanel ID="upTreatment" runat="server" UpdateMode="Conditional">
                <ContentTemplate>
                    <asp:GridView ID="gvTreatment" runat="server" AutoGenerateColumns="False"
                        CellPadding="4" DataKeyNames="CD_TREATMENT" ForeColor="#333333"
                        GridLines="None" Width="100%">
                        <AlternatingRowStyle BackColor="White" ForeColor="#333333" />
                        <Columns>
                            <asp:BoundField DataField="CD_TREATMENT" HeaderText="CD_TREATMENT"
                                ReadOnly="True" SortExpression="CD_TREATMENT" Visible="False" />
                            <asp:BoundField DataField="DT_CREATE" DataFormatString="{0:dd/MM/yyyy}"
                                HeaderText="Data Diagnóstico" ReadOnly="True" SortExpression="DT_CREATE" />
                            <asp:BoundField DataField="NM_PROCEDURE" HeaderText="Procedimento"
                                ReadOnly="True" SortExpression="NM_PROCEDURE" />
                            <asp:BoundField DataField="NM_REGION" HeaderText="Região" ReadOnly="True"
                                SortExpression="NM_REGION" />
                            <asp:BoundField DataField="NM_TOOTH" HeaderText="Dente" ReadOnly="True"
                                SortExpression="NM_TOOTH" />
                            <asp:BoundField DataField="QT_PRICE" HeaderText="Preço" ReadOnly="True"
                                SortExpression="QT_PRICE" />
                            <asp:TemplateField>
                                <ItemTemplate>
                                    <asp:ImageButton ID="btnGridFinishTreatment" runat="server"
                                        ImageUrl="~/Images/botao-finalizar.png"
                                        Text="" />
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField>
                                <ItemTemplate>
                                    <asp:ImageButton ID="btnGridModifyTreatment" runat="server"
                                        ImageUrl="~/Images/botao-editar.png"
                                        Text="" />
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField>
                                <ItemTemplate>
                                    <asp:ImageButton ID="btnGridDeleteTreatment" runat="server"
                                        ImageUrl="~/Images/botao-excluir.png" OnClick="btnGridDeleteTreatment_Click"
                                        Text="" />
                                </ItemTemplate>
                            </asp:TemplateField>
                        </Columns>
                        <EditRowStyle BackColor="#999999" />
                        <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                        <HeaderStyle BackColor="#44A6BF" Font-Bold="True" Font-Size="10pt"
                            ForeColor="White" HorizontalAlign="Left" VerticalAlign="Middle" />
                        <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
                        <RowStyle BackColor="#F7F6F3" Font-Size="10pt" ForeColor="#333333"
                            HorizontalAlign="Left" VerticalAlign="Middle" />
                        <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
                        <SortedAscendingCellStyle BackColor="#E9E7E2" />
                        <SortedAscendingHeaderStyle BackColor="#506C8C" />
                        <SortedDescendingCellStyle BackColor="#FFFDF8" />
                        <SortedDescendingHeaderStyle BackColor="#6F8DAE" />
                    </asp:GridView>

                    <asp:Button ID="btnShowDeleteTreatmentPopup" runat="server" style="display:none" />

                    <asp:ModalPopupExtender ID="gv_TreatmentModalDeletePopupExtender" runat="server"
                        TargetControlID="btnShowDeleteTreatmentPopup"
                        PopupControlID="pnlTreatmentModalDelete"
                        CancelControlID="btnCloseModalDeleteTreatment"
                        BackgroundCssClass="ModalBackground">                                                    
                    </asp:ModalPopupExtender>

                    <asp:Panel ID="pnlTreatmentModalDelete" runat="server" Style="display:none"
                        CssClass="ModalPopUp" Width="383px" BackColor="White" BorderColor="Red">
                        <div align="center">
                            <table width="100%" bgcolor="Red">
                                <tr>
                                    <td width="97%" align="center">
                                        <asp:Label ID="Label2" runat="server" Text="Exclusão de Item de Tratamento"
                                            Font-Bold="True" Font-Size="10pt" ForeColor="White"></asp:Label>    
                                    </td>
                                    <td align="center">
                                        <asp:ImageButton ID="btnCloseModalDeleteTreatment" runat="server" ImageUrl="~/Images/botao-fechar.png" />
                                    </td>
                                </tr>
                            </table>
                            <table width="100%">
                                <tr>
                                    <td width="20%"></td>
                                    <td></td>
                                </tr>
                                <tr>
                                    <td align="left">
                                        <asp:Label ID="Label4" runat="server" Text="Procedimento:"
                                            Font-Bold="False" Font-Size="10pt" Font-Italic="True"></asp:Label>
                                    </td>
                                    <td align="left">
                                        <asp:Label ID="lblDeleteProcedure" runat="server"
                                            Font-Bold="False" Font-Size="10pt" Font-Italic="True"></asp:Label>
                                    </td>
                                </tr>
                                <tr>
                                    <td align="left">
                                        <asp:Label ID="lblDeleteToothTitle" runat="server"
                                            Font-Bold="False" Font-Size="10pt" Font-Italic="True"></asp:Label>
                                    </td>
                                    <td align="left">
                                        <asp:Label ID="lblDeleteTooth" runat="server"
                                            Font-Bold="False" Font-Size="10pt" Font-Italic="True"></asp:Label>
                                    </td>
                                </tr>
                                <tr>
                                    <td></td>
                                    <td></td>
                                </tr>
                                </table>
                            <table width="100%">
                                <tr>
                                    <td align="center">
                                        <asp:Label ID="Label13" runat="server" Text="Confirma a exclusão deste item?"
                                            Font-Bold="True" Font-Size="10pt"></asp:Label>
                                    </td>
                                </tr>
                            </table>                                              
                            <br />
                            <asp:Button ID="btnModalDeleteTreatment" runat="server" Text="Confirmar"
                                onClick="btnModalDeleteTreatment_Click" BackColor="Red" BorderColor="Black"
                                BorderStyle="Solid" BorderWidth="1px" Font-Size="12pt" ForeColor="White"
                                Height="28px" Width="120px"/>
                            <asp:RoundedCornersExtender ID="btnModalDeleteTreatment_RoundedCornersExtender"
                                runat="server" BorderColor="Black" Enabled="True"
                                TargetControlID="btnModalDeleteTreatment">
                            </asp:RoundedCornersExtender>
                            <br />
                            <br />
                        </div>
                    </asp:Panel>
                    <asp:RoundedCornersExtender ID="pnlTreatmentModalDelete_RoundedCornersExtender"
                        runat="server" BorderColor="Red" Enabled="True"
                        TargetControlID="pnlTreatmentModalDelete">
                    </asp:RoundedCornersExtender>
                    

                    <asp:UpdateProgress ID="upgTreatment" runat="server"
                        AssociatedUpdatePanelID="upTreatment" DisplayAfter="0">
                        <ProgressTemplate>
                            Processando...
                        </ProgressTemplate>
                    </asp:UpdateProgress>

                </ContentTemplate>
                <Triggers>
                    <asp:AsyncPostBackTrigger ControlID="btnFilter" EventName="Click" />
                </Triggers>
            </asp:UpdatePanel> 
       
        </div>

    quinta-feira, 29 de novembro de 2012 12:08

Respostas

  • Veja essa solução

    http://blogs.visoftinc.com/2008/03/13/Modal-UpdateProgress-for-UpdatePanel-Revisited/


    Não esqueça de usar o componente </> na barra para posta seu código. Microsoft MCPD,MCTS,MCC

    sexta-feira, 30 de novembro de 2012 10:57
    Moderador

Todas as Respostas

  • Olá,

    Se entre o clique no botão e a exibição do Modal Popup for muito curto, você poderia aumentar o tempo mínimo para exibição do UpdateProgress, por meio da propriedade DisplayAfter="x" deste (onde x é o tempo em milissegundos).

    Esta alteração irá refletir em toda a página, portanto, se colocar um tempo muito alto, pode ser que ele não apareça mais para as outras funcionalidades.

    • Sugerido como Resposta Diego Cotini segunda-feira, 3 de dezembro de 2012 13:34
    quinta-feira, 29 de novembro de 2012 13:45
  • Veja essa solução

    http://blogs.visoftinc.com/2008/03/13/Modal-UpdateProgress-for-UpdatePanel-Revisited/


    Não esqueça de usar o componente </> na barra para posta seu código. Microsoft MCPD,MCTS,MCC

    sexta-feira, 30 de novembro de 2012 10:57
    Moderador