Link to home
Start Free TrialLog in
Avatar of gbzhhu
gbzhhuFlag for United Kingdom of Great Britain and Northern Ireland

asked on

How do I refresh parent page after closing a popup screen

I am using ASP.NET 1.1 with vb.net and xsl.  On an asp.net page I open a window as

window.open("events.aspx?fn=editEvent&eventId=" +evtId, "EditEvent", "width=660,height=900,location=no,scrollbars=yes");

User clicks save event on the popup window.  I run server code to save event data to DB then pass control to xsl where I run javascript as follows

window.close();
At this point I'd like to reload the page from which I opened the popup window.  I tried this

window.opener.location.reload();
but it requires me to click on the save events button twice and even then will popup a dialog asking "IE needs to resend blah blah"

What is the best way to do this

Cheers
H

ASKER CERTIFIED SOLUTION
Avatar of rajvja
rajvja
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of gbzhhu

ASKER

rajvja,

Wow! that's exactly what I wanted.  Brilliant.  Thank you.

Now, I saw this somewhere when I googled but my strict programming background told me it is useles because it looks like it is assigning 2 values that are already exactly the same.  Like saying 1 = 1.  so could you tell me what is happening here, where is the magic

Cheers
H
Avatar of Gurvinder Pal Singh
you need to do it at the unload event of the child window.
Window.Opener will reference the parent window that openes the popup.
Location.href=value // refreshing the page with the assigned url.
We are getting the url from the parent itself, means reloading the page.
check this code to detect the child window close from the parent window
http://jsbin.com/usuco/edit

If you are invoking that javascript at the unload event of the child window, it will be invoked even when you are navigating to a different link in the child window.

Avatar of gbzhhu

ASKER

rajvja,
That makes sense.  Thanks for explaining.

gurvinder372,
I don't need an unload.  There is only one button on the popup and that's where I want to close the window and refresh the parent.  If user closed the popup from the x button I don't want to do anything

THanks

Avatar of gbzhhu

ASKER

Excellent solution