简体   繁体   English

如何在子页面帖子的父页面中重新加载部分视图

[英]How to reload a partial view in a parent page on child page post

The parent page contains 3 partial views in it Index_Top, Index_Left and Index_main. 父页面在其中包含3个局部视图Index_Top,Index_Left和Index_main。 On hitting a button in Index_Left a new window opens using window.open("MyController/ChildPage") function in javascript. 按下Index_Left中的按钮后,将使用javascript中的window.open(“ MyController / ChildPage”)函数打开一个新窗口。

Now I should reload only the Index_Left on the parent page on the child page submit. 现在,我应该仅在子页面提交的父页面上重新加载Index_Left。

Can any one help me how can I do it? 谁能帮助我该怎么做?

I tried using like below. 我尝试使用如下。 $.post("/MyController/ChildPage/", { }, function (result) { if (result.Message == "OK") { window.opener.location.reload(true); window.close(); } }, "json"); $ .post(“ / MyController / ChildPage /”,{},函数(结果){if(result.Message ==“ OK”){window.opener.location.reload(true); window.close();} },“ json”);

But, it is reloading the entire parent page. 但是,它正在重新加载整个父页面。 But, I want to reload only a Index_Left parital page. 但是,我只想重新加载Index_Left Parital页面。

Inside the main page define a javascript function: 在主页内定义一个javascript函数:

function reloadLeftPanel() {
    // Do an AJAX request and reload the left panel like for example:
    $('#leftPanel').load('<%= Url.Action("MyController", "ChildPage") %>');
}

And in the popup window call this function whenever you want to reload the left panel on the opener page: 每当您要重新加载打开器页面上的左面板时,在弹出窗口中调用此函数:

window.opener.reloadLeftPanel();

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

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