ASP.NET Refreshing one window from another
4 answers
If you just need to call the postback on the calling page, this should work:
<script>
window.parent.document.forms[0].submit();
</script>
By explicitly submitting the form, you avoid the warning that appears if you simply refresh the calling page.
If you need to fire the OnSelectedIndexChanged event on the GridView during a postback, things get a little weird, but you have to do it by calling window.parent.document.__doPostBack()
with the appropriate arguments.
0
source to share
Here's the solution:
Dim CloseScript As String = "<script language='javascript'>function closeWindow(){ window.opener.document.forms[0].submit();window.close();}closeWindow();</script>"
In .NET 2.0, you have to add this to the page to register above Javascript:
'register with ClientScript
'The RegisterStartupScript method is also slightly different
'from ASP.NET 1.x
Dim s As Type = Me.[GetType]()
If Not ClientScript.IsClientScriptBlockRegistered(s, "CloseScript") Then
ClientScript.RegisterClientScriptBlock(s, "CloseScript", CloseScript)
End If
0
source to share