admin管理员组

文章数量:1391925

So I've used javascript to open a popup window in asp with c# codebehind, and I need a buttonclick event on the popup to both close the popup and refresh the parent page. Is there a method for this?

So I've used javascript to open a popup window in asp with c# codebehind, and I need a buttonclick event on the popup to both close the popup and refresh the parent page. Is there a method for this?

Share Improve this question edited May 8, 2011 at 19:13 Ace Troubleshooter asked May 8, 2011 at 19:04 Ace TroubleshooterAce Troubleshooter 1,3797 gold badges29 silver badges44 bronze badges 1
  • 1 You can access window.opener from within the popup so window.opener.location.reload could do the trick. – pimvdb Commented May 8, 2011 at 19:11
Add a ment  | 

2 Answers 2

Reset to default 5

To change the location/refresh the parent window you can use the opener property.

This one will change the href of the parent from the pop-up.

window.opener.location.href = the_url;

The reload method will work too, This does a hard reload (returns forms to default values) The optional boolean conditional argument will if true make a new request of the server, if false it will attempt to pull the page from the cache.

window.opener.location.reload(true);

If you want to preserve form data (soft reload), use the history method.

window.opener.history.go(0); 

'0' causes the page to reload, a negative value represents how many steps backward you'd like to go.

Also try this

window.location.href=window.location.href

本文标签: cRefresh page on popup closeStack Overflow