asp.Net   发布时间:2022-04-07  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了asp.net-mvc – 如何在客户端Kendo UI网格中实现服务器端分页在asp.net mvc中大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
任何人都可以告诉我如何使用客户端Kendo UI Grid实现服务器端页面?

解决方法

将gridPaging设置为true后,网格将发送当前pageSize并跳过。在服务器端,您应该使用提供的信息页面您的数据,并将其与总数量一起返回。以下是代码段:

行动

public ActionResult Products(int pageSize,int skip) 
{
     using (var northwind = new NorthwindDataContext())
     {
        var products = northwind.Products;
        // Get the @R_426_10586@l number of records - needed for paging
        var @R_426_10586@l = products.Count();

        // Page the data
        var data = products.Skip(skip).Take(pageSizE).ToList();

        // Return as JSON - the Kendo Grid will use the response
        return Json(new { @R_426_10586@l = @R_426_10586@l,data = data });
     }
}

视图

$("#grid").kendoGrid({
    datasource: {
        transport: {
            read: {
               url: "home/products",dataType: "json",type: "POST"
            }
        },scheR_732_11845@a: {
            data: "data",// records are returned in the "data" field of the response
            @R_426_10586@l: "@R_426_10586@l" // @R_426_10586@l number of records is in the "@R_426_10586@l" field of the response
        },serverPaging: true // enable server paging
    }
});

使用LINQ分页

> Take() and Skip()

Datasource配置设置

> serverPaging
> schema.data
> schema.total

大佬总结

以上是大佬教程为你收集整理的asp.net-mvc – 如何在客户端Kendo UI网格中实现服务器端分页在asp.net mvc中全部内容,希望文章能够帮你解决asp.net-mvc – 如何在客户端Kendo UI网格中实现服务器端分页在asp.net mvc中所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。