Bind the model to partialview on post

时间:2015-06-02 01:13:48

标签: c# asp.net asp.net-mvc

I have partialviews inside a view. I am rendering the partial views using RenderAction Method

<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 ?

1 个答案:

答案 0 :(得分:0)

尝试使用Url.Action代替Html.RenderAction

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