简体   繁体   English

在发布时将模型绑定到partialview

[英]Bind the model to partialview on post

I have partialviews inside a view. 我在视图中有局部视图。 I am rendering the partial views using RenderAction Method 我正在使用RenderAction方法渲染部分视图

<div class="report">
        @{ Html.RenderAction("ActionName", "ControllerName");}
    </div>

in the partial view I have a post back where in I update the Model and send it to the partial view using 在局部视图中,我有一个帖子回发,在其中我更新模型并将其发送到使用

return PartialView("_PartialView");

The whole of the view gets refreshed 整个视图都刷新了

The viewmodel of the parent page is different to the viewmodel of the partialpages 父页面的视图模型与部分页面的视图模型不同

Is there a way I can only refresh the partialview on the partialview postback ? 有什么办法可以只刷新partialview回发的partialview吗?

Try Url.Action instead of Html.RenderAction 尝试使用Url.Action而不是Html.RenderAction

<div class="report">
    @{ Url.Action("ActionName", "ControllerName");}
</div> 

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

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