Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Clicking an Imagebutton to close a popup and refresh the parent page

Status
Not open for further replies.

ShikkurDude

Programmer
Mar 15, 2005
55
US
I have a page "ChangeEvent.aspx" that (using JavaScript) pops up a window. On the popup I have a "Cancel" Imagebutton. I am trying to get that button-click to close the popup and refresh the parent ("ChangeEvent.aspx").

The following code does accomplish closing the popup, but it's not refreshing the parent.
Code:
	Private Sub btnCancel_Click(ByVal sender As System.Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles btnCancel.Click
		Dim script As String = "<script language=""javascript"">" & System.Environment.NewLine & "self.close()" & System.Environment.NewLine & "self.parent.location = self.parent.location.href=""ChangeEvent.aspx""" & "</script>"
		Page.RegisterStartupScript("PopupClose", script)
	End Sub
How, please, do I get the above code to also refresh the parent?

Thanks so much,
E.
 
I got it!
Code:
	Private Sub ClosePopupAndRefreshParentWindow()
		Dim script As String = "<script language=""javascript"">" & System.Environment.NewLine & "self.close()" & System.Environment.NewLine & "opener.location.reload(); self.close();" & "</script>"
		Page.RegisterStartupScript("PopupCloseAndRefresh", script)
	End Sub

:)
E.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top