Click here to Skip to main content
15,886,806 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
Hi Everyone!

I just want to know how am I going to show a popup loading image(GIF) on button click event. The problem is when I do the this.ModalPopupExtender1.Show(); followed by a line of codes it isn't showing up.

I have this codes:
ASP.NET (ASPX)
XML
<asp:Button ID="btnOK" runat="server" Text="" Style="display:none"
            onclick="btnOK_Click"/>
    <asp:Button ID="btnPopupPanel" runat="server" Text=""
            onclick="btnPopupPanel_Click" />
    <cc1:ModalPopupExtender ID="ModalPopupExtender1" runat="server"
        BackgroundCssClass="modalBackground" PopupControlID="pnlPopupMsg"
        TargetControlID="btnPopupPanel">
      </cc1:ModalPopupExtender>
    <asp:Panel ID="pnlPopupMsg" runat="server" CssClass="modalPopup">
        <table align="center">
          <tr><td align="center"><img src="../../images/ajax_loader_red_512.gif" height="80px" width="80px" /></td></tr>
        </table>
        <div align="center">
            <asp:Label ID="lblLoading" runat="server" Text="Loading..."
            Font-Bold="True" Font-Names="Arial" Font-Underline="False"
            ForeColor="#E52724"></asp:Label></div>
      </asp:Panel>



Situation No.1 :
C# CodeBehind Code

C#
protected void btnSync_Click(object sender, EventArgs e)
       {  this.ModalPopupExtender1.Show();} 

In this situation if its the modalpopupextender is the only code to be executed it shows up but I cannot hide it anymore.


XML
Situation No.2 :
C# CodeBehind Code

protected void btnSync_Click(object sender, EventArgs e)
       {  this.ModalPopupExtender1.Show(); //followed by a line of code/method calls} </pre>


In this situation, the modalpopupextender isn't showing up anymore.

Can somebody explain what wrong with these situations or suggest me more efficient and working popup image? Thanks in advance! Have a nice day everyone!

P.S. I hope my question is clear cause im just new in this organization. ^_^
Posted
Comments
ZurdoDev 23-Jan-15 21:59pm    
Modal popup means it will block the UI so you can't do other things while it is up. JavaScript is not multithreaded so for changes to the UI to show up you have to end that thread and then kick off another one which does your processing. You use setTimeout() to do this.
Member 11248293 23-Jan-15 23:21pm    
Thank you for that information RyanDev, how am i going to fire the my event while loading is up?
ZurdoDev 24-Jan-15 9:26am    
google setTimeout examples. You'll see.

For example, you load your dialog in JS:
dlg.Load(); // whatever code it takes to show it client-side
setTimeout("myFunction", 1);

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