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.
How should I hide it, once the download is done.
ASPX:
<asp:UpdateProgress Id="UpdateProgress 1" runat="server" DisplayAter="1">
<ProgressTemplate>
<asp:Image id="imgWait" runat="server" ImageUrl="~/Images/wait.gif"/>
</ProgressTemplate>
</asp:UpdateProgress>
JS:
function HideImage()
{
$(#imgWait).hide();
}
Code Behind:
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);
}
Download.Aspx:
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();
}
}
}