如何分页列表<实体>在Mvc(绩效问题) [英] How Can I Paging List<Entity> In Mvc (Performance Issue)

查看:61
本文介绍了如何分页列表<实体>在Mvc(绩效问题)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有模型中的实体列表,我想将其渲染为网格允许分页,导致当我渲染所有实体时页面渲染缓慢



这里是当前的代码

i have list of entities in model , i want to render it as grid allow paging , cause when i render all entities the page render slowly

here is current code

<div class="col_full nobottommargin" id="divUnlinkedUserClients">
<input type='checkbox' onclick="return checkAll(this);">
                                    Select All checkbox
 @{
    for (int i = 0; i < Model.UnlinkedUserClients.Count; i++)

    {

     <div>

      @Html.CheckBoxFor(m => Model.UnlinkedUserClients[i].IsSelected)

      @Model.UnlinkedUserClients[i].FullNameLastFirst

      @if (Model.UnlinkedUserClients[i].UserClientStatusId ==        RspPublic.Models.Enumerations.UserClientStatus.PendingLinkToAccount)
       {
        <text> (Pending Access)</text>
       }

     </div>
    }
 }
</div>

推荐答案

有很多可分页的基于javascript / jquery的网格。他们中的一些人也有你可以使用的MVC助手。尽管如此,如果分页是唯一的要求,那么在控制器中使用jquery和ajax后端实现起来非常简单。

这是一种方法: ASP的自定义分页。 NET MVC [ ^ ]

看看这些:

http://www.codeguru.com/csharp/article.php/c18513/Add-Simple-Ajax-Paging-to -Grids-in-ASPNET-MVC.htm [ ^ ]

http://www.techiesweb.net/paging-sorting-filtering-to-your-asp-net-mvc -projects-with-ktable-plugin / [ ^ ]

http://www.lybecker.com/blog/2014/09/29/ajax-paging-for- asp-net-mvc-sites / [ ^ ]

http://www.joe-stevens.com/2011/05/30/asp-net-mvc-simple-server- side-ajax-paging-using-jquery / [ ^ ]
There are many pageable javascript/jquery based grids out there. Some of them have also MVC helpers you can use. Still, if pagination is the only requirement, it is quite simple to implement with jquery and an ajax backend in the controller.
This is one approach: Custom Pagination with ASP.NET MVC[^]
Take a look also on these:
http://www.codeguru.com/csharp/article.php/c18513/Add-Simple-Ajax-Paging-to-Grids-in-ASPNET-MVC.htm[^]
http://www.techiesweb.net/paging-sorting-filtering-to-your-asp-net-mvc-projects-with-ktable-plugin/[^]
http://www.lybecker.com/blog/2014/09/29/ajax-paging-for-asp-net-mvc-sites/[^]
http://www.joe-stevens.com/2011/05/30/asp-net-mvc-simple-server-side-ajax-paging-using-jquery/[^]


这篇关于如何分页列表&lt;实体&gt;在Mvc(绩效问题)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆