我在我的MVC项目中列出了如下数据。但我的数据超过10000.填充数据时,它会冻结并占用太多时间。我想加快填充datatable.How可以吗?
调节器
public ActionResult ListData()
{
frsDTO obj = new frsDTO();
obj.students = ent.Students.ToList();
return View(obj);
}
视图
<table class="table table-striped table-bordered table-hover" id="sample_1">
@foreach (var item in Model.genelParametreler)
{
<tr>
<td>@item.ParametreAdi</td>
<td>@item.Deger</td>
<td>@item.Aciklama</td>
<td><a onclick="location.href = '/Parametre/[email protected]';" style="cursor:pointer"> <span class="fa fa-pencil-square-o"></span> Güncelle</a></td>
<td><a id="@item.ParametreID" onclick="parametreSil(@item.ParametreID)" style="cursor:pointer; color:red"><span class="fa fa-times" style="color:red"></span>Sil</a></td>
</tr>
}
</table>
我不知道您的框架的具体细节,但您应该考虑对结果进行分页。这样,您只能从数据库中加载少量项目,而不是一次加载10000个项目。 https://en.wikipedia.org/wiki/Pagination