asp.net-mvc – 如何在客户端Kendo UI网格中实现服务器端分页在asp.net mvc中
发布时间:2020-05-23 11:22:56 所属栏目: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 – PostbackUrl vs NavigateUrl
- 在ASP.Net网站项目中混合VB.Net和C#代码?
- asp.net – 无法加载文件或程序集“System.Web.Mvc,Version
- asp.net-mvc – 使用自己的HtmlHelper扩展名用于模型绑定的
- asp.net-mvc – 为什么在ASP.NET MVC中使用lambdas而不是反
- asp.net – 在WatiN中如何等到回发完成
- asp.net – 以纯文本识别URL
- ASP.NET身份验证在自定义机票上滑动到期时间
- asp.net – 需要一个必须同时具有数字和字母字符的字符串的
- 使用ASP.NET MVC3中的JavaScriptSerializer转义引号
