如何使用Javascript关闭showModalDialog后刷新父页面 [英] How to refresh parent page after close of showModalDialog using Javascript
问题描述
在我的一个网络应用程序中,我有一个父页面,父页面上有一个按钮,点击此按钮我正在调用显示模态对话框的javascript函数。
In one of mine web application, i have one parent page, there is one button on parent page, on click this button i am calling javascript function for show Modal Dialog.
<script type="text/javascript">
function getUrlVars() {
var vars = {};
var parts = window.location.href.replace(/[?&]+([^=&]+)=([^&]*)/gi, function (m, key, value) {
vars[key] = value;
});
return vars;
}
function OpenDialog() {
var _payrollId = getUrlVars()["payrollId"];
if (_payrollId != "") {
Options = "dialogWidth:900px;dialogHeight:500px;help:no;scroll:yes;status:no:";
OpenReportJS = window.showModalDialog("/PickList/PayrollHead.aspx?payrollId=" + _payrollId, "_blank", Options);
}
}
</script>
----------- --------------
现在在子页面中我有一个按钮,当我单击此按钮时想要关闭show modal对话框并想要刷新父级页面。
我怎么能这样做,请给我一些提示......
-------------------------
Now in the child page i have one button and when i click this button want to close the show modal dialog and want to refresh the parent page.
How can i do this, please give me some hints...
推荐答案
父窗口刷新javascript代码是
Parent window refresh javascript code is
window.opener.location.href='Parent.aspx';
你刚才关闭模态对话框后调用该行。 Parent.aspx是您只需将其替换为父页面的页面示例。
You just call that line after close modal dialog. Parent.aspx is a example of page you just replace it with your parent page.
这篇关于如何使用Javascript关闭showModalDialog后刷新父页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!