title: ImageURL doesn't work inside Update Panel
body: <p>I am writing a captcha authentication program in ASP.NET C#. The problem i face is that the image gets refreshed on entering wrong value during a postback; but same image doesn't get refreshed during a partial postback, when i keep them inside an update panel.</p>
  
  <p><strong>aspx source</strong></p>
  
  <pre><code>&lt;asp:UpdatePanel ID="UpdatePanel1" runat="server"&gt;
              &lt;ContentTemplate&gt;            
              &lt;asp:Image ID="ImageCaptcha" runat="server" ImageUrl="~/BringImg.aspx" /&gt;&lt;br /&gt;
              &lt;asp:TextBox ID="txtCaptcha" runat="server" &gt;&lt;/asp:TextBox&gt;&lt;br /&gt;                        
              &lt;asp:Button ID="btnSubmit" runat="server" Text="Submit Project"  OnClick="btnSubmit_Click"/&gt;
              &lt;/ContentTemplate&gt;
  &lt;/asp:UpdatePanel&gt;
  </code></pre>
  
  <p><strong>Code Behind:</strong></p>
  
  <pre><code>private System.Random rand = new System.Random();
  protected void Page_Load(object sender, EventArgs e)
      {
          if (!Page.IsPostBack)
          {
              this.Session["Captcha"] = GenerateRandomCode();
          }
      }
  protected void btnSubmit_Click(object sender, EventArgs e)
      {
          string temp = this.Session["Captcha"].ToString();
          if (string.Compare(temp, this.txtCaptcha.Text.Trim()) == 0)
          {            
              // success logic
          }
          else
          {                     
              this.lblResult.Text = "Validation Text was not correct.";
              this.Session["Captcha"] = GenerateRandomCode();
              ImageCaptcha.ImageUrl = "~/BringImg.aspx";
              ImageCaptcha.DataBind();
          }
      }
  </code></pre>