I am struggling with an issue where I am opening a pop-up from the code behind as a waiting image while processing some background activities. However, the pop-up does not close after the activity is done. Can someone please help me figure out what I am doing wrong? Below is the relevant code snippet:
System.Text.StringBuilder sb = new System.Text.StringBuilder();
sb.Append("<script language='javascript'>");
sb.Append("var win=");
sb.Append("window.open('WaitingImage.aspx', 'Wait',");
sb.Append("'width=800, height=600, menubar=no, resizable=no');window.focus();<");
sb.Append("/script>");
Type t = this.GetType();
if (!ClientScript.IsClientScriptBlockRegistered(t, "PopupScript"))
{
ClientScript.RegisterClientScriptBlock(t,"PopupScript", sb.ToString());
}
//pop up opened.. now do the processing :-
uploadFiles();
//now close the pop up after work is done:-
System.Text.StringBuilder sbs = new System.Text.StringBuilder();
sbs.Append("<script language='javascript'>");
sbs.Append("window.close()");
sbs.Append("/script>");
Type tr = this.GetType();
ClientScript.RegisterClientScriptBlock(tr, "PopupScript", sbs.ToString());