I have a parent page and child page, both aspx. All is working, but now I would like to close child page, if user leaves child popup page and goes back to parent page and clicks on something else like page index of Gridview. I CANNOT close popup child page if user goes to another app, or some other location, I only want to close if something on parent page is changed.
I have the PageIndexChange Event set up for other purposes, I would just like to add some functionality, perhaps a script manager to close the child popup page if the Gridview index is changed, java or another way which ever works best.
I think I might also need to check if the child page is even open.
Any help and examples would be greatly appreciated.
EDITED: This is the code that opens the popup child page…
' Sets up popup to open when row selected for edit is cycled in DataRowBound event
If IsPostBack Then
If (e.Row.RowState And DataControlRowState.Edit) > 0 Then
If Session("updateComplete") <> "Y" And Session("CancelUpdate") <> "Y" Then
Dim BrowserSettings As String = "status=no,toolbar=no, scrollbars =yes,menubar=no,location=no,resizable=no," & "titlebar=no, addressbar=no, width=650, height=800"
Dim URL As String = "pttStringPopUp.aspx"
Dim scriptText1 As String = ("<script>javascript: var w = window.open('" & URL & "','_blank','" & BrowserSettings & "'); </script>")
ScriptManager.RegisterStartupScript(Me, GetType(Page), "ClientScript1", scriptText1, False)
Session("updateComplete") = "N"
End If
End If
End If
Thanks,
You can attach an
onclickhandler in theRowDataBoundevent, and in the event close the popup:ASPX: