MVC Html.Partial or Html.Action

Here are what I consider my guidelines on using Html.Action or Html.Partial

Html.Partial

  1. Use Html.Partial when you are rendering static content or,
  2. If you are going to pass data from the ViewModel that is being sent to the main view

Html.Action

  1. Use Html.Action when you actually need to retrieve additional data from the server to populate the partial view

Basically, if is static, use Html.Partial(). If dynamic, model independent data, use Html.Action(). There are probably more scenarios, but this will give you a good idea of where/how to go. Html.RenderPartial() and Html.RenderAction() are interchangeable for the similarly named functions above.

Leave a Comment