title: How to hide UpdateProgress Image
body: <p>I have one Ajax UpdateProgress for many UpdatePanels in the page. One of the updatepanel's has a gridview with a download button. Once user clicks on the button, the 'wait' Image shows up, but keeps showing even after the download is complete.</p>
  
  <p>How should I hide it, once the download is done.</p>
  
  <p><strong>ASPX:</strong></p>
  
  <pre><code>&lt;asp:UpdateProgress Id="UpdateProgress1"  runat="server" DisplayAter="1"&gt;
      &lt;ProgressTemplate&gt;
          &lt;asp:Image id="imgWait" runat="server" ImageUrl="~/Images/wait.gif"/&gt;
      &lt;/ProgressTemplate&gt;  
  &lt;/asp:UpdateProgress&gt;
  </code></pre>
  
  <p><strong>JS:</strong></p>
  
  <pre><code>function HideImage()
  {
      $(#imgWait).hide();
  }
  //Also tried
  //Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler);
  
  //function EndRequestHandler(sender, args)
  //{
  //   document.getElementById('&lt;%=imgWait.ClientID%&gt;').className = 'hidden';
  //}
  </code></pre>
  
  <p><strong>Code Behind:</strong></p>
  
  <pre><code>protected void Download(object sender, CommandEventArgs e)
  {
      string sFile = e.CommandArgument.ToString();
      Response.Redirect("Download.Aspx?file="+sFile,false);
      ScriptManager.RegisterStartupScript(this.Page,this.GetType(),
                                      "script","HideImage();",true);
  }
  </code></pre>
  
  <p><strong>Download.Aspx</strong></p>
  
  <pre><code>page_load()
  {
      if(!string.IsNullOrEmpty(Request.QueryString["file"]))
      {
          string path = Server.MapPath(Request.QueryString["file"]);
          System.IO.FileInfo file = new System.IO.FileInfo(path);
          if ( file.Exists )   
          {
              Response.Clear();
              Response.AddHeader("Content-Disposition", "attachment; filename=" +  
                                file.Name);
              Response.AddHeader("Content-Length", file.Length.ToString());
              Response.ContentType = "application/octet-stream";
              Response.WriteFile(file.FullName);
              Response.Flush();
              Response.End();
          }
      }
  }
  </code></pre>