I just asked a 开发者_StackOverflow中文版question about use of these. They were suggested to me as a means to include text ( paragraphs of text ) into a web page. VERY STATIC text that I don't want to fill up the view with.
My question is. Which of these two should I use and also is there an overhead to using them. I thought views were compiled just once. How about if I include these files. Does that mean that every time I view a page then it has to go get the file.
Firstly, have a read through Html.Partial vs Html.RenderPartial & Html.Action vs Html.RenderAction and then you can read this post, http://5pm.zwares.com/post/1172669451/asp-net-mvc-performance-html-renderpartial-vs
in summary, the post contains this bit of useful information from Phil Haack
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.
精彩评论