I have a linkbutton "terms and conditions "on a master page.. when use clicks on it a popup window is displayed usingthis code
Dim myScript As String
myScript = "<script>window.open('Terms.aspx?',null,'height=750, width=1024,status= no,resizable= no, scrollbars=yes,toolbar=no,location=no,menubar=no'); </script>"
ScriptManager.RegisterStartupScript(Me, Me.[GetType](), "pop", myScript, False)
I have a accept button on pop up window page on which i am closing this pop up
ClientScript.RegisterStartupScript(GetType(Page), "closePage", "window.close();", True)
The problem is i want to refresh the parent window once this pop up is closed. How can i achieve this? This did not work Refreshing Parent window after closing popup
UPDATE
<div style="padding:5px 0;">
<asp:Button ID="btnAccept" runat="server" Text="Accept" OnClientClick="Refresh()" style="HEIGHT: 19px;background: #C0003B;color: white; " /> <asp:Button ID="btnReject" runat="server" Text="Reject" OnClientClick="Refresh()" style="HEIGHT: 19px;background: #C0003B;color: white;"/>
</div>
function Refresh() {
return confirm('Are you sure?');
window.onunload = refreshParent;
function refreshParent() {
window.opener.location.reload();
}
}
I have a linkbutton "terms and conditions "on a master page.. when use clicks on it a popup window is displayed usingthis code
Dim myScript As String
myScript = "<script>window.open('Terms.aspx?',null,'height=750, width=1024,status= no,resizable= no, scrollbars=yes,toolbar=no,location=no,menubar=no'); </script>"
ScriptManager.RegisterStartupScript(Me, Me.[GetType](), "pop", myScript, False)
I have a accept button on pop up window page on which i am closing this pop up
ClientScript.RegisterStartupScript(GetType(Page), "closePage", "window.close();", True)
The problem is i want to refresh the parent window once this pop up is closed. How can i achieve this? This did not work Refreshing Parent window after closing popup
UPDATE
<div style="padding:5px 0;">
<asp:Button ID="btnAccept" runat="server" Text="Accept" OnClientClick="Refresh()" style="HEIGHT: 19px;background: #C0003B;color: white; " /> <asp:Button ID="btnReject" runat="server" Text="Reject" OnClientClick="Refresh()" style="HEIGHT: 19px;background: #C0003B;color: white;"/>
</div>
function Refresh() {
return confirm('Are you sure?');
window.onunload = refreshParent;
function refreshParent() {
window.opener.location.reload();
}
}
Share
Improve this question
edited May 23, 2017 at 12:30
CommunityBot
11 silver badge
asked Sep 11, 2013 at 8:48
SamuraiJackSamuraiJack
5,56917 gold badges103 silver badges212 bronze badges
1 Answer
Reset to default 2You can access parent window using 'window.opener', so, write something like the following in the child window:
onunload="window.opener.location.reload();"
or use this
<script>
window.onunload = refreshParent;
function refreshParent() {
var retVal = confirm("Are you sure ?");
if( retVal == true ){
window.opener.location.reload();
else
return false;
}
</script>