As you said, you want to close from code behind. So you can render Page.ClientScript.RegisterClientScriptBlock(GetType(), "CloseScript", "refreshParentPage()", true);
from code behind to refresh the parent.
Just add the following code and script in Child Page. No code is needed in parent page.
<script>
function getRadWindow() {
var oWindow = null;
if (window.radWindow)
oWindow = window.radWindow;
else if (window.frameElement.radWindow)
oWindow = window.frameElement.radWindow;
return oWindow;
}
// Reload parent page
function refreshParentPage() {
getRadWindow().BrowserWindow.location.reload();
}
</script>
<asp:Button runat="server" Text="Close" ID="CloseButton"
OnClick="CloseButton_Click"/>
protected void CloseButton_Click(object sender, EventArgs e)
{
Page.ClientScript.RegisterClientScriptBlock(GetType(),
"CloseScript", "refreshParentPage()", true);
}
Update:
// Redirect page page to url
function redirectParentPage(url) {
getRadWindow().BrowserWindow.document.location.href = url;
}
// Code behind
Page.ClientScript.RegisterClientScriptBlock(GetType(),
"CloseScript", "redirectParentPage('Parent.aspx')", true);