asp.net-mvc - 剑道网格不显示任何数据
问题描述
我的项目是 asp.net core 3.1,我尝试将剑道网格与读取操作绑定。我的剑道网格是空的,没有显示任何数据
这是我的行动:
public JsonResult Read([DataSourceRequest] DataSourceRequest request)
{
var data = _context.Products.OrderByDescending(c => c.Id);
DataSourceResult result = data.ToDataSourceResult(request,
model => new Product
{
Id=model.Id,
Title=model.Title
});
//return Json(result, JsonRequestBehavior.AllowGet);
return Json(result);
}
这是我的剑道网格:
@model IEnumerable<DomainModel.Product>
@addTagHelper *, Kendo.Mvc
@using Kendo.Mvc.UI
@(Html.Kendo().Grid<DomainModel.Product>()
.Name("grid")
.Columns(columns =>
{
columns.Bound(c => c.Id);
columns.Bound(c => c.Title);
})
.HtmlAttributes(new { style = "height: 550px;" })
.Scrollable()
.Groupable()
.Sortable()
.Pageable(pageable => pageable
.Refresh(true)
.PageSizes(true)
.ButtonCount(5))
.DataSource(dataSource => dataSource
.Ajax()
.Read(read => read.Action("Read", "Products"))
.PageSize(15)
)
)
谢谢
解决方案
推荐阅读
- javascript - 更改数组变量名称
- javascript - KaIOs - Kaiads 频率上限生效。kaios 广告未按时响应
- typescript - 如何正确定义包装 3rd 方类的代理的类型?
- python - 从列表中查找数据框中单词的频率
- c# - 如何预防/修复 - 外部服务交互 (DNS)
- html - 是否可以在未选中时将选项值设置为“false”以发送电子邮件?
- xml - 如何为 XML 文件编写 xPath
- r - 使用唯一 ID 合并两个数据帧而不重复
- python - 计算每小时 Python 熊猫的入住人数
- java - 通过 websockets 上的 amqp 从 kubernetes 集群内部连接到 azure iot hub