I have an UpdateProgress control to activate on a postback of a LinkButton control in UpdatePanel. The LinkButton_click event is performing a Response.Redirect to pull up a Downloading. The Download comes up and the UpdateProgress bar is spinning on the page with the button. Either cancel downloading the UpdateProgress image is still there spinning.
1- How can I make the UpdateProgress bar to finish and go away?
2- How can Freez page while spinning loding?
My code is
protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
{
if (e.CommandName == "Downloads")
{
int index = int.Parse(e.CommandArgument.ToString());
GridViewRow selectedRow = GridView1.Rows[index];
string cid = selectedRow.Cells[1].Text;
DownloadFile();
}
public void DownloadFile()
{
string directoryString = Session.SessionID;
DirectoryInfo folder = Directory.CreateDirectory(directoryString);
foreach (FileInfo file in folder.GetFiles())
{ file.Delete(); }
..
.
.
string ss = GridView2.Rows[0].Cells[1].Text;
string s = GridView2.Rows[0].Cells[2].Text;
string filename_path = "D:\\VLS\\" + s + "\\" + ss;
if (File.Exists(filename_path))
{
lberror.Visible = false;
string filename = filename_path;
System.Threading.Thread.Sleep(1000);
Response.Redirect("downloading.aspx?folder=" + directoryString + "&file=" + fname + "&DownloadName=" + ss);
}
else
{
lberror.Visible = true;
lberror.Text = "File does not exist";
}
}
Thanks,