Refresh Parent Page From Child Popup Page

If you want to modify your parent page data from the child popup page then look at the code provided by me.

Suppose you have a page which have some gridview,dropdown etc.
and on button click you open a popup window and from that popup window you choose something and then updates the parent page and close the popup window.
then following code is illustrating the same problem.
Have a look at the same

Code for Main window

(I am giving only the button code from which popup window will open,Let the Page name will be Default.aspx)

<asp:Button ID="btnSubmit" runat="server" Text="Submit" OnClientClick="'PopUp.aspx','DK','width=100px,height=100px');" />

Code for PopUp.aspx

<html xmlns="">

<head runat="server">


<script language="javascript" type="text/javascript">

function CloseWin()


window.opener.parent.location.href="Default.aspx";//Default.aspx is the Main Parent Page Name from where Popup is open

<form id="form1" runat="server">
<asp:Button ID="btnSubmit" runat="server" Text="Add" onclick="btnSubmit_Click" />

Code for PopUp.aspx.cs

(Code Behind)

protected void btnSubmit_Click(object sender, EventArgs e)
//Do you database insertion here
//Whatever you want to do here like adding data into session
//or view state and then take this data on the page load of the parent
Page.ClientScript.RegisterStartupScript(this.GetType(), "closewin", "CloseWin();", true);



Author: Aneeta Kanaujia25 Mar 2010 Member Level: Bronze   Points : 1

Thanks dear for such a nice code.
I was searching for the same and was not able to find .
it solv my problem.
Thanks agaian.

Guest Author: jittipong21 Mar 2012

Thank you too much so much very much very much right now

Guest Author: jittipong21 Mar 2012

thank you too much so much very much right now

Guest Author: atul dubey24 Mar 2013

Hello Sir,
i have search page and i m binding grid on click on search button.and in grid i gave hyperlink for edit respective records and on click on link editpage.aspx gets open into fancy box and after successfully update of records i am closing fancy directly. now i am trying to refresh grid after close of fancy and want to display new updated record which gets update.
i tried above code but not working. sir plz help me

Author: Dharmendra Kumar05 Apr 2013 Member Level: Gold   Points : 2

Dear Atul,
The above code only works when you are opening new page. It will not work when you are opening any modal popup within the page.

Please provide your full specification and send me a mail @ dharment.hbti at gmail dot com and visit my blog . I will post a new post with the solution of your problem.

  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name: