gbzhhu
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?f n=editEven t&even tId=" +evtId, "EditEvent", "width=660,height=900,loca tion=no,sc rollbars=y es");
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.rel oad();
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
window.open("events.aspx?f
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.rel
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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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.
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.
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.
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
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
ASKER
Excellent solution
ASKER
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