javascript - Refresh the parent page after closing a pop up window -


i have aspx page has gridview in there update button. when click update button pop window opens. second aspx page (pop windows) has fields delete button. when click delete button second aspx page close , row deleted gridview in first aspx page. i'm not able see row has been deleted gridview until refresh manually page.

how can refresh parent page(the page has gridview) right after closing second page (the pop window page)?? tried didn't work :

response.write("<script>window.close();</" + "script>"); response.write("<script>window.opener.location.reload();</" + "script>"); 

you can use window.opener in pop window, add

window.opener.location.reload(); 

in pop window on onbeforeunload or onunload event. won't work on chrome, works on firefox.

another work around can use setinterval check if pop window closed or not in main page:

var page = null; function openpopup() {      page = window.open("desiredpage.html","windowname", "width=200,height=200");      setinterval(function() {         if(page != null && page.closed) {             window.location.reload();         }     }, 1000); } 

second solution works on browsers.


Comments

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

.htaccess - ERR_TOO_MANY_REDIRECTS htaccess -