views:

197

answers:

0

On my Application, i've created a "ModalPopupUpdateProgress" schema:

My form is composed of several buttons, and only two of them are under the UpdatePanel control. That's because i can't have all of the buttons triggering the UpdateProgress (at least on all situations). Let's focus on the btnSalvar control.

 <asp:Panel runat="server" ID="PanelUpdateProgress">  
     <asp:UpdateProgress ID="UpdateProgress1" runat="server" DisplayAfter="0">  
         <ProgressTemplate>  
             <div style="border-style: groove; background-color:     FFFFE0; width: 294px; text-align: center">  
                 <img alt="Atenção!" src="../imagens/attention.gif" />  
                 Salvando notas, por favor aguarde...<br />  
                 <img alt="Salvando Notas..." src="../imagens/carregando_avalia.gif" /></div>  
         </ProgressTemplate>  
     </asp:UpdateProgress>  
 </asp:Panel>  
 <asp:ModalPopupExtender BackgroundCssClass="modalBackground" ID="ModalProgress" runat="server"  
     Enabled="True" TargetControlID="PanelUpdateProgress" PopupControlID="PanelUpdateProgress"  
     DropShadow="False" />

They trigger the UpdateProgress, and, with a simple hack, i show it on a ModalPopupExtender.

//Linking the ModalPopup with the UpdateProgress instance  
Sys.WebForms.PageRequestManager.getInstance().add_beginRequest(beginReq);   
Sys.WebForms.PageRequestManager.getInstance() .add_endRequest(endReq);      
function beginReq(sender, args){   
    $find(ModalProgress).show();  
}  
function endReq(sender, args) {  
    $find(ModalProgress).hide();  
} 

And that's how i've gotten my headache: The other buttons (outside of the UpdatePanel), at a certain combination of events, call the btnSalvar click event, but, somehow, it doesn't trigger a PageRequestManager request manager event and because of that, doesn't show the ModalPopup with the UpdateProgress window.

TL;DR: How can i programmatically generate an async request (calling a click event on a registered async control from a non-registered async control) so that the PageRequestManager's BeginRequestEvent is raised and JS code is executed (thus showing the ModalPopup with the UpdateProgress)?

I accept other suggestions on other ways to show de UpdateProgress+ModalPopup too.

Thanks in advance,

Leonardo Jr.