Friday, 21 August 2009

How to close a window using ASP.Net server side

After doing what needs to be done you can register some startup script to close your browser window like this:

string closeScript = "<script language="javascript">window.top.close();</script>";
if (!ClientScript.IsStartupScriptRegistered("clientScript"))
  ClientScript.RegisterStartupScript(Page.GetType(), "clientScript", closeScript);

No comments:

Post a Comment

Note: only a member of this blog may post a comment.