mercredi 14 janvier 2015

MVC slow page load times with many elements

I have a new MVC application that is loading extremely slow on a specific page. In this page I recently added a checkboxlist using this form:



<div class="editor-label">
@Html.LabelFor(model => model.CategoryViewModel.ChildCategoryNodes)
</div>
<div class="editor-field">
@{
for(int i=0; i<Model.CategoryViewModel.ChildCategoryNodes.Count; i++)
{
@Html.HiddenFor(model => model.CategoryViewModel.ChildCategoryNodes[i].Value)
@Html.CheckBoxFor(model => model.CategoryViewModel.ChildCategoryNodes[i].Selected)
@Html.LabelFor(model => model.CategoryViewModel.ChildCategoryNodes[i].Text)
}
}
@Html.ValidationMessageFor(model => model.CategoryViewModel.ChildCategoryNodes)
</div>


This is generated from a query and creates ~2000 elements. Unfortunately shortly after the page renders it becomes unusable for 20-30 seconds, which is making debugging a colossal pain (ignoring the issue when it goes to production and starts annoying end users).


I've disabled jquery validation and nothing else is running. Any thoughts?





Aucun commentaire:

Enregistrer un commentaire