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) {
var mdlPopUp = $find('<%= mdlPopup.ClientID %>');
mdlPopUp.show();
}
function EndRequest(sender, args) {
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() {
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.