I am new to asp.net MVC so please bear with me. I need build a menu that repeats across multiple views. What would better serve the purpose Html.Action
OR Html.Partial
.
I am new to asp.net MVC so please bear with me. I need build a menu that repeats across multiple views. What would better serve the purpose Html.Action
OR Html.Partial
.
Here are what I consider my guidelines on using Html.Action or Html.Partial
Html.Partial
Html.Partial
when you are rendering static content or, Html.Action
Html.Action
when you actually need to retrieve additional data from the server to populate the partial viewBasically, 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.