0

I'm trying to do a simple loading gif with ASP.NET AJAX Update Panel.

Markup:

<body>
    <form id="form1" runat="server">
        <div>

            <asp:ScriptManager ID="ScriptManager1" runat="server">
            </asp:ScriptManager>

            <asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
                <ContentTemplate>
                    <asp:Button ID="btnWork" runat="server" OnClick="btnWork_Click" Text="Work" />
                    <asp:Panel ID="Panel1" runat="server" Visible="False">
                        like a spinner jif...
                    </asp:Panel>
                </ContentTemplate>
                <Triggers>
                    <asp:AsyncPostBackTrigger ControlID="btnWork" EventName="Click" />
                </Triggers>
            </asp:UpdatePanel>

        </div>
    </form>

Code-behind:

public partial class WebForm1 : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }

    protected void btnWork_Click(object sender, EventArgs e)
    {
        Panel1.Visible = true;
        Thread.Sleep(3000);
        Panel1.Visible = false;
    }
}

The problem is Panel1 never shows up.

Rod
  • 14,529
  • 31
  • 118
  • 230
  • rather than does this with code behind and an update panel, why not use Jquery and font awesome? other than that, are you able to put a break point in and hit the break point? Also, what type of project is this, I assume its a WebForms application, are you using master pages? – Simon Price Dec 17 '15 at 16:49
  • it's part of the requirements to use ASP.Net Web Forms. Not using master pages. Can't use client-side solution here. – Rod Dec 17 '15 at 16:58
  • You can't just sleep and expect it work. Even with an UpdatePanel, the entire server side is processed before sending the results to the client side. – mason Dec 17 '15 at 16:59

0 Answers0