Let's forget about state management, maintenance perspective, etc ... and focus on render performance only
Which of render method has better performance ? <%= ... %> or Server Control (or Html Server Control/ Custom Control/ UserControl) ?
e.g 1: Page1 vs
e.g 2: using <% %> with foreach to render a DataTable vs using DataGrid
In my opinion, <% %> will win not only in these 2 examples but also in most cases开发者_如何学C. As in ASP.NET MVC, we use inline code in Views to render HTML.
What's your opinion ?
It's a lot more difficult to manage <% %> code and it tends to be more brittle, IMO.
It might be faster, but you lose maintainability. I have found if it's a data-heavy page, the price of the SQL Query is more expensive than the rendering speed of a GridView or a Repeater.
(That and turning off ViewState.)
精彩评论