Refresh a parent page from a child iframe, with codebehind
two pages
1. Parent page = "TaskSummary.aspx"-Summary with data in grid
2. iframe = "CreateTask.aspx" -New Task Creation page with save button .When i close save button from popup page ,i want to refresh TaskSummary.aspx page grid
Refresh a parent page from a child iframe, with codebehind
2 Answers
Know the answer? Post it. Somebody with the same question will find it here.

Rijwan AnsariRank #82 · 24.2K reputationPosted Nov 6, 2023, 10:46 AM EST
You can refresh with JavaScript.
Add below JavaScript into Parent Page
function refreshParent() { location.reload(); }In child iFrame, call the JavaScript.
parent.refreshParent();You can also use the
postMessage()method to communicate between the parent page and the child iframe. To do this, you would first send a message from the child iframe to the parent page indicating that you want to refresh the page. The parent page would then receive the message and call therefreshParent()function.Rijwan AnsariRank #82 · 24.2K reputationPosted Nov 6, 2023, 10:49 AM EST
Using Codebehind
protected void RefreshParent(object sender, EventArgs e) { // Get the parent page. Page parentPage = (Page)Page.Parent; // Refresh the parent page. parentPage.ClientScript.RegisterStartupScript(typeof(Page), "RefreshParent", "location.reload();", false); }RefreshParent()method when clicked. For example