?
Solved

How do I refresh parent page after closing a popup screen

Posted on 2010-01-13
7
Medium Priority
?
667 Views
Last Modified: 2013-12-17
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
Comment
Question by:gbzhhu
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
  • 2
7 Comments
 
LVL 11

Accepted Solution

by:
rajvja earned 2000 total points
ID: 26302016

you can write the script before closing the popup window,

window.opener.location.href = window.opener.location.href;
0
 
LVL 12

Author Comment

by:gbzhhu
ID: 26302052
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
 
LVL 40

Expert Comment

by:Gurvinder Pal Singh
ID: 26302075
you need to do it at the unload event of the child window.
0
Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

 
LVL 11

Expert Comment

by:rajvja
ID: 26302102
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
 
LVL 40

Expert Comment

by:Gurvinder Pal Singh
ID: 26302159
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
 
LVL 12

Author Comment

by:gbzhhu
ID: 26302215
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
 
LVL 12

Author Closing Comment

by:gbzhhu
ID: 31676571
Excellent solution
0

Featured Post

Is Your Team Achieving Their Full Potential?

74% of employees feel they are not achieving their full potential. With Linux Academy, not only will you strengthen your team's core competencies but also their knowledge of of the newest IT topics.

With new material every week, we'll make sure that you stay ahead of the game.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Having worked on larger scale sites, we found out that you are bound to look at more scalable solutions to integrating widgets, code snippets or complete applications and mesh them into functional sites, in any given composition. To share some of…
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question