I have been trying to figure this out for a while and I see many similar questions but not exactly what I'm looking for.
I have a .php page as a parent page, and it has an iFrame which displays a .aspx page. What I want to do is: when user clicks a button inside the aspx page, close the modal iframe and go back to the php page.
parent.php
+-------------------------------------------+
| |
| |
| "survey" |
| CloseSurvey() |
| +--------------------------+ |
| | | |
| | | |
| | child.aspx | |
| | +---------------+ | |
| | | | | |
| | | btnClose | | |
| | | | | |
| | | | | |
| | | | | |
| | +---------------+ | |
| | | |
| | | |
| +--------------------------+ |
| |
+-------------------------------------------+
void btnClose_Click(object sender, EventArgs e)
{
//Close iframe
}
I have tried
ClientScript.RegisterStartupScript(typeof(Page), "CLOSEWINDOW", "parent.CloseSurvey()");
and it didn't do anything. No error, and won't close.
I've been trying to figure out how I can call the method in parent, but I still can't figure it out yet.
How can I close the modal iframe popup from child.aspx??