Difference between Html.Partial and Html.RenderPartial and Html.Action and Html.RenderAction
Html.Partial returns MVCHtmlString which can be assigned to a variable and manipulate if required.
Syntax : @Html.Partial("ViewName")
Html.RenderPartial returns void and output will be written directly to the output stream.
Syntax : @{ Html.RenderPartial("ViewName"); }
Note: We can also pass the model to the Partial
Syntax : @Html.Partial("ViewName", Model)
@{ Html.RenderPartial("ViewName", Model) }
Html.Action Invokes the specified child action method and returns the result as an HTML string
Syntax : @{string result = @Html.Action("Action", "Controller", new { param = "value"} ).ToString();}
Html.RenderAction Invokes the specified child action method and renders the result inline in the parent view.
Syntax : @{Html.Action("Action", "Controller", new { param = "value"} ).ToString();}
Note: This method is faster than the Action method since its result is directly written to the HTTP response stream.
Note: This method is faster than the Action method since its result is directly written to the HTTP response stream.
Comments
Post a Comment