[英]Refresh only update panel on parent from pop-up window
I have a button which opens a pop-up window and an Ajax update panel. 我有一个按钮,它会打开一个弹出窗口和一个Ajax更新面板。 Inside that window I have another button. 在该窗口内,我还有另一个按钮。
What code do I have to run if I want that update panel to be refreshed, when I press the button from the parent page, without refreshing the whole page? 如果要在不刷新整个页面的情况下刷新父面板上的按钮时要刷新该更新面板,必须运行什么代码?
I sow this code on a web which refreshes the page: 我在网上刷新此代码,以刷新页面:
<div id="Container" onclick="__doPostBack('UpdatePanel1', '');">
I am such a good friend with Java. 我是Java的好朋友。
You need to utilize window.opener object. 您需要利用window.opener对象。
window.opener.document.getElementById('Container').onclick();
I'd suggest using jQuery to ensure cross-browser compatibility. 我建议使用jQuery来确保跨浏览器的兼容性。 And also adding some null-checks of course. 当然,还添加了一些空检查。
Use Jquery : 使用Jquery:
If the DIV ID remains static : 如果DIV ID保持静态:
$("#Container").click(function() {
// REFRESH CONTAINER HERE
});
If the Div ID is dynamic then make use of class instead of ID: 如果Div ID是动态的,则使用class代替ID:
$(".Container").click(function() {
// REFRESH CONTAINER HERE
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.