Html.Partial vs Html.RenderPartial & Html.Action vs Html.RenderAction. can any one please describe the difference

南楼画角 提交于 2019-12-01 04:41:41

Html.Action invokes the controller's action, which means it instantiates the controller entity, calls an action method, which builds a model an returns a view result.

Html.Partial uses already created model (or can be called without model at all) to render a specified view.

When to use one over the other? If you already have a model and just want to have a reusable view, opt to Html.Partial. If you see that some piece deserves its own model and action, maybe it makes sense to use Html.Action.

This question is discussed in much greater details in this article, and what you see above is basically an excerpt from it.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!