@Html.Action
- @Html.Action returns string.
- Syntax : @Html.Action(“Action”,”Controller”).
- Pass parameter with Action method Syntax : @Html.Action(“Action”,”Controller”, new {ParameterName=ParameterValue}).
- It is slower as compared to @Html.RenderAction.
- It’s result can be manipulated before rendering to the output stream.
- Manipulation : @{ var data= Html.Action(“Action”,”Controller”, new {ParameterName=ParameterValue}); } @data I am Software Developer.
- Use when data length is small or need to manipulate result before rendering to the output stream.
@Html.RenderAction
- @Html.RenderAction returns void.
- Syntax : @{ Html.RenderAction (“Action”,”Controller”); }
- Pass parameter with RenderAction method Syntax : @{ Html.RenderAction (“Action”,”Controller”, new {ParameterName=ParameterValue});}.
- It is faster as compared to @Html.Action because this result is written directly to the output stream.
- It’s result can not be manipulated.
- Use when data length is large or no need to manipulate result before rendering to the output stream.