Does anybody know what's the difference between Html.RenderAction and Html.Action?
Partial injects the html string of the partial view into the main view. Html. RenderPartial writes html in the response stream. Here is what I have found:Use RenderAction when you do not have a model to send to the view and have a lot of html to bring back that doesn't need to be stored in a variable.
The action attribute specifies where to send the form-data when a form is submitted.
RenderPartial is used to display a reusable part of within the same controller and RenderAction render an action from any controller. They both render the Html and doesn't provide a String for output.
RenderAction(HtmlHelper, String) Invokes the specified child action method and renders the result inline in the parent view. RenderAction(HtmlHelper, String, Object) Invokes the specified child action method using the specified parameters and renders the result inline in the parent view.
Html.Action()
– Outputs string
Html.RenderAction()
– Renders directly to response stream
If the action returns a large amount of HTML, then rendering directly to the response stream provides better performance than outputting a string.
The difference between the two is that Html.RenderAction will render the result directly to the Response (which is more efficient if the action returns a large amount of HTML) whereas Html.Action returns a string with the result.
check out this link for a detailed explanation
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With