1
I would like a help to better understand these types of partial view rendering.
1
I would like a help to better understand these types of partial view rendering.
4
Html.Renderaction
This method result will be written directly to the HTTP stream Response response stream used. It means that the same object used as Textwriter will also be used for the page and/or template.
For this method, you need to create a Child action to render the partial view.
The Renderaction Method is useful when the data that is used in the partial view is idenpendentes of the corresponding view model. Example: In a blog to show list of categories on each page, we would like to use the Renderaction method since the category list would be populated by a different model.
@{Html.Renderaction("Category","Home");}
This method is the best choice when caching a partial view view.
This method is faster than a simple Action call for example, since the answer is also used directly via the HTTP stream, making the response faster.
Html.Renderpartial
The Renderpartial Method is useful when partial view display data is already view model. For example : In a blog, to show the comments of an article, we would like to use the Renderpartial method since the article with the comments are already pre-filled in the view model.
@{Html.Renderpartial("_Comments");}
Fonte Completa: http://codigosimples.net/2016/03/05/diferencas-entre-renderpartial-vs-renderaction-vs-partial-vs-action-no-mvc/
Browser other questions tagged c# asp.net-mvc
You are not signed in. Login or sign up in order to post.