Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 676
  • Last Modified:

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

0
gbzhhu
Asked:
gbzhhu
  • 3
  • 2
  • 2
1 Solution
 
rajvjaCommented:

you can write the script before closing the popup window,

window.opener.location.href = window.opener.location.href;
0
 
gbzhhuAuthor Commented:
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
0
 
Gurvinder Pal SinghCommented:
you need to do it at the unload event of the child window.
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
rajvjaCommented:
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.
0
 
Gurvinder Pal SinghCommented:
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.

0
 
gbzhhuAuthor Commented:
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

0
 
gbzhhuAuthor Commented:
Excellent solution
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 3
  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now