ASP.NET MVC View Html.DisplayFor Renders Very Slow

2013-12-23


We had a 2000 rows data model to display on ASP.NET MVC view page, but when we tried running we found that the web page seems always crashed: no more response.

First we thought it was server side, we spent long time to debug but finally we found the total 2000 rows have already transferred to client, so the problem must be caused by client web page, then we checked the view, we used Html.DisplayFor to render the data list item, then we knew the issue must caused by the Html.DisplayFor rendering.

Then we thought the Html.DisplayFor must come with some performance issue. but no else found the issue ?

After searching, we got to know it was not about Html.DisplayFor performance, but the issue caused by our Debug setting in our web.config file.

The answer is: DO NOT set the debug = "true" but set to "false" !

  <compilation debug="false" targetFramework="4.5.1"/>

Why? Please visit here to get more information.