开发者

Is there an overhead with @Html.RenderPartial or @Html.Partial in MVC3

开发者 https://www.devze.com 2023-03-16 20:57 出处:网络
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 t

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号