To open pop-up
//ButtonControl is id of button on whose click pop-up needs to be opened. Place below lines on pageLoad, rowDataBound or some other place as needed.
string popupPagePath = "http://www.ravigupta.in";
ButtonControl.Attributes.Add("onclick", "window.open('" + popupPagePath + "','','width=400, height=600'); return false;");
To close child window(pop-up) and then refresh the parent window.
Javascript code for closing child and refreshing parent
window.close();
if (window.opener && !window.opener.closed) {
window.opener.location.reload();
}
For using in ASP.NET, write below on event handler of control that initiates close of popup.
ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), "CloseWindow", "window.close(); if (window.opener && !window.opener.closed) { window.opener.location.reload(); }", true);
//ButtonControl is id of button on whose click pop-up needs to be opened. Place below lines on pageLoad, rowDataBound or some other place as needed.
string popupPagePath = "http://www.ravigupta.in";
ButtonControl.Attributes.Add("onclick", "window.open('" + popupPagePath + "','','width=400, height=600'); return false;");
To close child window(pop-up) and then refresh the parent window.
Javascript code for closing child and refreshing parent
window.close();
if (window.opener && !window.opener.closed) {
window.opener.location.reload();
}
For using in ASP.NET, write below on event handler of control that initiates close of popup.
ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), "CloseWindow", "window.close(); if (window.opener && !window.opener.closed) { window.opener.location.reload(); }", true);
This worked for me. Hope it helps you too.