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"))
)
)
Here is my controller action:
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.
Thanks in advance.
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" />
I think you mis one of the js
in your page , probebly Jquery-1.8.1.min.js
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With