简体   繁体   English

如何从父窗口刷新子弹出窗口?

[英]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.. 我正在使用链接按钮上的服务器代码从asp.net的父窗口中打开一个子弹出窗口。

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 UPDATE

Parent Page: For eg: I have linkbutton 100 linkbutton 101 linkbutton 102 父页面:例如:我有linkbutton 100 linkbutton 101 linkbutton 102

If I click 100 it shows pop up with 100 displayed on it (using session). 如果我单击100,它将显示弹出窗口,其中显示100(使用会话)。 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. 如果我关闭此子弹出窗口,然后在父窗口上单击101,则它将打开带有101的子弹出窗口,这是正确的。 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. 但是,如果我不关闭当前显示101的子弹出窗口,但仍在父窗口上单击102,那么无论我单击什么链接,它都不会在子窗口上显示102而是仍然显示旧值101。

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(); 
});

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM