Unable to Close Popup window using ASP.Net
I am using Asp.net web application.....
I am having a problem closing a popup window opened modally. When I
try to
close the window (when the user hits Search button and the data
has been
processed), the Popup window opens as a full screen as a new
window. The
original window plus the Modally opened Pop remain in a
separate
window.
What I want to do is close the popup and return to the original
window
with its view state maintained.
The control use to fire the
popup window and the one to save the
changes need to be a web server
control.
The popup window needs to be
modal.
here i am using show modal dialog......
**************************************************
*************************
The code I am using open the window with this control is:
Main.aspx.cs
=========
protected void Button1_Click(object sender, EventArgs e)
{
string url = "window.showModalDialog('WebForm2.aspx',null,'font-size:10px;dialogWidth:43em;dialogHeight:40em,toolbar=0,location=0,directories=0,status=no,menuB ar=1,scrollBars=no,resizable=no')";
if (!ClientScript.IsClientScriptBlockRegistered("OpenPopup"))
ClientScript.RegisterClientScriptBlock(typeof(string), "OpenPopup", url, true);
}
**************************************************
*************************
Sub.aspx
=======
protected void Button4_Click(object sender, EventArgs e)
{
Response.Write("<script language=\"Javascript\">window.opener=self;window.close();</script>");
Response.End();
//Response.Write("<script type='text/javascript' language='javascript'>window.close();</script>"); [this code one of option ]
//string script = "this.window.opener.location=this.window.opener.location;this.window.close();"; [this code one of option ]
//if (!ClientScript.IsClientScriptBlockRegistered("REFRESH_PARENT"))
// ClientScript.RegisterClientScriptBlock(typeof(string), "REFRESH_PARENT", script, true);
}
What ever action i did in the sub.aspx[modal popup] will open new full screen
Hopefully someone has a solution in this regard.
Cheers.
Kumar