Html.Partial or Html.RenderPartial with MVC3?

后端 未结 1 1356
独厮守ぢ
独厮守ぢ 2021-02-20 17:14

I am totally confused even after seeing the following explanation.

@Html.Partial(\"_FeaturedProduct\")

Partial views

1条回答
  •  粉色の甜心
    2021-02-20 17:43

    See the response below.

    The only difference is that Partial returns an MvcHtmlString, and must be called inside <%= %>, whereas RenderPartial returnsvoid and renders directly to the view.

    If you look at the source code, you'll see that they both call the same internal method, passing a StringWriter for it to render to.

    You would call Partial if you want to view, save, or manipulate the generated HTML instead of writing it to the page.

    What is the difference (if any) between Html.Partial(view, model) and Html.RenderPartial(view,model) in MVC2?

    0 讨论(0)
提交回复
热议问题