0

How can I run a function after closing the popup window?

This is my button click to open the popup window:

 ImageButton btnEdit = (ImageButton)sender;
 GridViewRow row = (GridViewRow)btnEdit.NamingContainer;
 string url;
 url = "Add-Bank.aspx?a=E&id=" + txtEmployeeCode.Text.Trim() + "&acc=" + 
 ((HiddenField)row.FindControl("hidRecID")).Value;           
 Response.Write("<script>window.open('" + url + "',400,600);</script>");

And in my popup window, close button code is:

 this.ClientScript.RegisterClientScriptBlock(this.GetType(), "Close", "window.close()", true);

When I close the popup window how can I run the specific function or button click event?

What I tried is so far I created one click even called btnRefresh:

 protected void btnRefresh_Click(object sender, EventArgs e)
 {
   LoadData();
 }

I tried to run this event from popup window but it's not hitting the event as:

 <script type="text/javascript">
  $(document).ready(function () {
  var cpframe = top.document.getElementById('contframe');
  if (cpframe) {
   cpframe.contentWindow.document.getElementById('Main_btnRefresh').click();
   }
   });

 </script>

thanks in advance.

Prashant Pimpale
  • 10,349
  • 9
  • 44
  • 84
NAJEEB
  • 251
  • 2
  • 13

0 Answers0