【发布时间】:2017-07-27 17:59:05
【问题描述】:
这是我的操作方法
public ActionResult Kendo([DataSourceRequest]DataSourceRequest request )
{
var emp = EmployeeManager.GetAllEmployees();
DataSourceResult result = emp.ToDataSourceResult(request);
return Json(result);
}
这是我从官方网站获取的网格代码
@model IEnumerable<MyProject.Web.Models.EmployeeViewModels.EmployeeViewModel>
@using Kendo.Mvc.UI;
@(Html.Kendo().Grid<TalentPro.Employees.Employee>()
.Name("grid")
.DataSource(dataSource => dataSource //Configure the Grid data source.
.Ajax() //Specify that Ajax binding is used.
.Read(read => read.Action("Kendo", "Home")
) //Set the action method which will return the data in JSON format.
)
.Columns(columns =>
{
//Create a column bound to the ProductID property.
columns.Bound(product => product.Id);
//Create a column bound to the ProductName property.
columns.Bound(product => product.FirstName);
//Create a column bound to the UnitsInStock property.
columns.Bound(product => product.LastName);
columns.Bound(product => product.EmailId);
columns.Bound(product => product.PhoneNumber);
})
.Pageable() // Enable paging
.Sortable() // Enable sorting
)
我浏览了官方文档,它帮助我将 Kendo ui 与我的 Asp.net 核心 项目集成。但我不知道我哪里出错了,它没有将数据与网格绑定。
我尝试了多种方法,但没有用。谁能帮我解决这个问题。
提前致谢。
【问题讨论】:
标签: kendo-ui kendo-grid asp.net-core-1.1