SamuraiJack
SamuraiJack

Reputation: 5539

How to refresh Child popup window from parent window?

I am opening a child pop up window from parent window in asp.net using this server code which is on a linkbutton..

myScript = "<script>window.open('frmAdvanceClaimPopup.aspx','frmAdvanceClaimPopup','height=400px, width=1024px,status= no,resizable= no, scrollbars=yes,toolbar=no,location=no,menubar=no'); </script>";

ScriptManager.RegisterStartupScript(this, this.GetType(), "pop", myScript, false);

But the problem with this is that I want the child window to get refreshed everytime I click the calling linkbutton on parent page. OR atleast close the child page first if its already open and then call it again. How can this be done?

UPDATE

Parent Page: For eg: I have linkbutton 100 linkbutton 101 linkbutton 102

If I click 100 it shows pop up with 100 displayed on it (using session). If I close this child pop up and then click 101 on parent, then it will open child pop up with 101 on it which is correct. But If I do not close the child pop up with which atthe moment shows 101 but still click 102 on parent then it does not show 102 on child instead it still shows the old value 101 no matter what link i click.

Upvotes: 0

Views: 2915

Answers (1)

schei1
schei1

Reputation: 2487

If you have a reference to the popup window, you can reload the window when you click the linkbutton through a click event or something similar.

var popup = window.open('frmAdvanceClaimPopup.aspx','frmAdvanceClaimPopup','height=400px, width=1024px,status= no,resizable= no, scrollbars=yes,toolbar=no,location=no,menubar=no') 

You need to make sure that the variable is accessible otherwise this won't work.

$( "#linkButton" ).click(function() {
  popup.location.reload(); 
});

Upvotes: 2

Related Questions