title: Update label from code behind
body: <p>I am relatively new to ASP.NET/C#. I am trying to update a label tag in a update panel from the code behind while a long running task is being processed. Basically there are a few tables that are being loaded from a database. I want to update the label to inform the user when each table finishes loading. After a lot of searching I implemented it as follows,</p>
  
  <pre><code>&lt;div id="LockPage" class="LockOff"&gt;
          &lt;div&gt;
              &lt;asp:ScriptManager ID="ScriptManager" runat="server"&gt;&lt;/asp:ScriptManager&gt;
              &lt;asp:UpdatePanel ID="UpdatePanel" runat="server" UpdateMode="Conditional"&gt;
                  &lt;ContentTemplate&gt;
                      &lt;asp:Image ID="LoadImg" AlternateText="Loading" runat="server" ImageUrl="Images/loading2.gif" /&gt;
                      &lt;asp:Label ID="WaitMsg" runat="server" Text="Please Wait...." /&gt;
                      &lt;br /&gt;
                  &lt;/ContentTemplate&gt;
              &lt;/asp:UpdatePanel&gt;
          &lt;/div&gt;
      &lt;/div&gt;
  </code></pre>
  
  <p>Code Behind: Inside a method when a table finishes:</p>
  
  <p><code>WaitMsg.Text = WaitMsg.Text + "Table 1 Completed!";
              UpdatePanel.Update();</code></p>
  
  <p>The above code doesn't work. Please help.</p>