asp.net-mvc – 如何在客户端Kendo UI网格中实现服务器端分页在a
发布时间:2020-12-15 18:47:37 所属栏目:asp.Net 来源:网络整理
导读:任何人都可以告诉我如何使用客户端Kendo UI Grid实现服务器端页面? 解决方法 UPDATE: We have 07000 an open source .NET library which makes paging,sorting an filtering a lot easier. 将gridPaging设置为true后,网格将发送当前pageSize并跳过。在服务
任何人都可以告诉我如何使用客户端Kendo UI Grid实现服务器端页面?
解决方法
将gridPaging设置为true后,网格将发送当前pageSize并跳过。在服务器端,您应该使用提供的信息页面您的数据,并将其与总数量一起返回。以下是代码段: 行动 public ActionResult Products(int pageSize,int skip) { using (var northwind = new NorthwindDataContext()) { var products = northwind.Products; // Get the total number of records - needed for paging var total = 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 { total = total,data = data }); } } 视图 $("#grid").kendoGrid({ dataSource: { transport: { read: { url: "home/products",dataType: "json",type: "POST" } },schema: { data: "data",// records are returned in the "data" field of the response total: "total" // total number of records is in the "total" field of the response },serverPaging: true // enable server paging } }); 参考 使用LINQ分页 > Take() and Skip() DataSource配置设置 > serverPaging (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
- asp.net-mvc – 当在视图中使用ko时,ko.applyBindings给出错
- asp.net-mvc – 在asp.net mvc应用程序中防止多个POST
- asp.net – 普通Web API或Web API和OData?
- asp.net-mvc – IE 11 SignalR不工作
- asp.net – Razor查看到Word文档或PDF
- asp.net-mvc – 可靠地处理ASP.NET MVC模型绑定错误
- ASP.NET Web API项目自动生成接口文档和测试页面
- asp.net-mvc – 使用ASP.NET MVC的BlueImp jQuery上传
- vbscript – 经典ASP 3.0从Recordset创建数组
- 从asp.net中的代码编写Html标记
推荐文章
站长推荐
- asp.net-mvc-3 – RedirectResult Object作为URL
- 即使ReadOnly设置为false,ASP.NET GridView中的C
- asp.net-mvc-3 – 使用Jquery Ajax渲染部分视图与
- 如何在.NET中使用TreeView控件创建三态复选框?
- asp.net – ServiceReference是一个自托管的WCF服
- asp.net-mvc – 在asp.net和ravendb中处理基于活
- .net – 在哪里存储第三方图书馆?
- asp.net-mvc – ASP.NET MVC 2中的验证是如何实际
- asp.net – 哪个NuGet包包含System.Web.Routing?
- asp.net-mvc – 看起来你忘了注册HTTP模块与Wind
热点阅读