Both Html.RenderAction and Html.Action can be used to call an Action method and render output of the action
method as embedded content in the main view, they can be used to display
content in a part of the main view page like user controls.
Html.RenderAction will render the output directly
to the response content, means that the content is generated at the server
side, embedded with the content of the main view page and send to the client as
a single response. This method is efficient if the Html.RenderAction is calling an action method which renders large
amount of content.
Html.Action will return the content of the calling Action method as a string, means that its content is not rendered with the parent view, but is called and rendered separate. This method is advisable if the amount of HTML returned from the view is limited, and when we want to dynamically load parts of pages based on user preferences / events.
No comments:
Post a Comment