Click here to Skip to main content
15,905,971 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have two asp buttons in the same update panel; For one of them I am using
<asp:PostBackTrigger ControlID="btnVerify" />
for the other I am not. But for both a progress bar should be fired; To fire this progress bar I am using begin and end request in a script block as below:

<script language="javascript" type="text/javascript">

    Sys.WebForms.PageRequestManager.getInstance().add_beginRequest(InitializeRequest);
    Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequest); 

    function InitializeRequest(sender, args) {
         // alert("Start");
         var mdlPopUp = $find('<%= mdlPopup.ClientID %>');
         mdlPopUp.show();
    }

    function EndRequest(sender, args) {
         // alert("End");
         var mdlPopUp = $find('<%= mdlPopup.ClientID %>');
         mdlPopUp.hide();
    }

  </script>


mdlPopup is the progress bar.

Below is my UpdatePanel:


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

      <asp:LinkButton ID="lnkBtn" runat="server">
         <asp:Image ID="Image2" runat="server" ImageUrl="~/images/BAL/go.gif" />
      </asp:LinkButton>

      <asp:ImageButton ID="btnVerify" TabIndex="14" runat="server" ImageUrl="~/Images/Misc/verify.gif">
      </asp:ImageButton>

   </ContentTemplate>
   <Triggers>
      <asp:PostBackTrigger ControlID="btnVerify" />
   </Triggers>
</asp:UpdatePanel>


Now the problem is that whenever I press on btnVerify progress bar is not shown; BUT if I press on lnkBtn progress bar is shown. I know that the problem is from postbackTrigger (I removed it from triggers and progress bar was displayed as excpected, but then, btnVerify won't work correctly). So how can I resolve this issue and display the progress bar when I press on both buttons?

Update: Please note that I press on btnVerify: InitializeRequest and EndRequest are not fired (start and end are not alerted; test init is alerted)

What I have tried:

I have made some searches and I found that I should add this in javascript:

Sys.Application.add_init(appl_init);

function appl_init() {
  // alert("test init"); 
   Sys.WebForms.PageRequestManager.getInstance().add_beginRequest(InitializeRequest);     
   Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequest);            
}


But unfortunately this did not help me, the progress bar is not fired when I press on btnVerify.
Posted
Updated 28-Mar-17 22:54pm
v4

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900