Kendo UI Grid没有调用READ方法 [英] Kendo UI Grid is not calling READ method
问题描述
按照要求,我在VIEW上有一个Kendo UI网格.但是可悲的是,读取功能没有在控制器中被击中.这很烦人,即使一切似乎都像我一样,我也遇到了同样的问题根据 http://demos.kendoui.com/web/grid/index提供的文档. html .这是我的查看代码:
As per the requirement, I am having a Kendo UI grid on my VIEW.But sadlyy, the read function is not being hit in the controller.This is annoying ,I am getting the same problem even though everyhting seems to be as per the documentation provided on http://demos.kendoui.com/web/grid/index.html. Here is my View code:
@(Html.Kendo().Grid<StudentManagement_Models.Student>()
.Name("studentsGrid")
.Columns(columns =>
{
columns.Bound(p => p.Id).Groupable(false);
columns.Bound(p => p.FirstName);
columns.Bound(p => p.MiddleName);
columns.Bound(p => p.LastName);
columns.Bound(p => p.CGPA);
})
.AutoBind(true)
.Pageable()
.Navigatable()
.Sortable()
.DataSource(dataSource => dataSource
.Ajax()
.Read(read => read.Action("GetAllStudents", "Student"))
)
)
这是我的控制器动作:
public ActionResult GetAllStudents([DataSourceRequest] DataSourceRequest request)
{
//Thread.Sleep(2000);
StudentManagement_Models.Student student = new StudentManagement_Models.Student();
StudentHelper helper = new StudentHelper();
student.SavedStudents = helper.GetAllStudents();
return Json(student.SavedStudents.ToDataSourceResult(request));
}
我该如何解决?我错过了什么吗?请提出建议.
How would I tackle this ?Am I missing something ?Kindly suggest.
谢谢.
推荐答案
将所有此文件添加到您的页面中
Add all of this file in your page
<script src="~/Script/Jquery-1.8.1.min.js" type="text/javascript"></script>
<script src="~/Script/jquery-ui-1.8.20.min.js" type="text/javascript"></script>
<script src="@Url.Content("~/Script/kendo.all.min.js")" type="text/javascript"></script>
<script src="~/Script/kendo.web.min.js" type="text/javascript"></script>
<script src="~/Script/kendo.aspnetmvc.min.js" type="text/javascript"></script>
<link href="~/Content/kendo.common.min.css" rel="stylesheet" type="text/css" />
<link href="~/Content/kendo.default.min.css" rel="stylesheet" type="text/css" />
我认为您误会了页面中的js
之一,仔细地Jquery-1.8.1.min.js
.
I think you mis one of the js
in your page , probebly Jquery-1.8.1.min.js
.
这篇关于Kendo UI Grid没有调用READ方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!