Html.Partial vs Html.RenderPartial & Html.Action vs Html.RenderAction

后端 未结 13 806
感动是毒
感动是毒 2020-11-22 04:03

In ASP.NET MVC, what is the difference between:

  • Html.Partial and Html.RenderPartial
  • Html.Action and Html.
13条回答
  •  鱼传尺愫
    2020-11-22 04:12

    @Html.Partial and @Html.RenderPartial are used when your Partial view model is correspondence of parent model, we don't need to create any action method to call this.

    @Html.Action and @Html.RenderAction are used when your partial view model are independent from parent model, basically it is used when you want to display any widget type content on page. You must create an action method which returns a partial view result while calling the method from view.

提交回复
热议问题