2009-10-07

Close window from server-side

// closethe page if successful update
RegisterStartupScript("load", "<" + "script type=\"text/javascript\">\n" +
"self.close();\n" +
"<" + "/script>");

Dim strscript As String = "<"+"script language=javascript>window.top.close();<"+"/script>"
If (Not ClientScript.IsStartupScriptRegistered("clientScript")) Then
ClientScript.RegisterStartupScript(Page.GetType(), "clientScript", strscript)
End If

System.Text.StringBuilder sb = System.Text.StringBuilder ();

sb.Append("");

if(!IsClientScriptRegistered("myScript",sb.ToString())
   this.RegisterClientScriptBlock("myScript",sb.ToString());

All of code was found in Internet

Комментариев нет: