RenderPartial vs Partial MVC
Html.RenderPartial
@{ Html.RenderPartial("ViewName"); }
@Html.Partial("ViewName")
The same is true for Html.Action and Html.RenderAction.
Html.RenderAction vs Html.Action
The return type of Html.RenderAction is void that means it directly render the responses in View where return type of Html.Action is MvcHtmlString you can catch its render view in controller and modify it also by using following method
@{ Html.RenderPartial("ViewName"); }
- This method result will be directly written to the HTTP response stream means it used the same TextWriter object as used in the current webpage/template.
- This method returns void.
- No need to create any action.
- You cannot do this with Html.RenderPartial. The result will be written to the Response stream during the execution.
Performance wise it's better to use RenderPartial.
Html.Partial@Html.Partial("ViewName")
- Renders the partial view as an HTML-encoded string.
- You can store the output of Html.Partial in a variable, or return it from a function.
- No need to create any action.
The same is true for Html.Action and Html.RenderAction.
Html.RenderAction vs Html.Action
The return type of Html.RenderAction is void that means it directly render the responses in View where return type of Html.Action is MvcHtmlString you can catch its render view in controller and modify it also by using following method
RenderPartial vs Partial MVC
Reviewed by Bhaumik Patel
on
7:59 PM
Rating: