First of all this is my first work using kendo ui. In work i have some data from database, i would like to replace my mvc webgrid into impressive kendo grid. I have created a list from database and iam trying to bind into kento grid. After setting data source by calling stored procedure. Still the grid remains empty. controller:
public ActionResult index()
{
return View();
}
public JsonResult Getuser([DataSourceRequest] DataSourceRequest request)
{
TestDB_Emp db = new TestDB_Emp();
var employees = db.sps_selectemp();
DataSourceResult response = employees.ToDataSourceResult(request);
return Json(response, JsonRequestBehavior.AllowGet);
}
view
@(Html.Kendo().Grid<webkendo.sps_selectemp_Result>()
.Name("grid")
.Columns(columns =>
{
columns.Bound(c => c.FirstName);
columns.Bound(c => c.SecondName);
columns.Bound(c => c.Email);
columns.Bound(c => c.Gender).Width(150);
})
.HtmlAttributes(new { style = "height: 550px;" })
.Scrollable()
.Groupable()
.Sortable()
.Pageable()
.DataSource(dataSource => dataSource
.Ajax()
.Read(read => read.Action("Getuser", "Home"))
.PageSize(20)
)
)
class
namespace webkendo
{
using System;
public partial class sps_selectemp_Result
{
public string City { get; set; }
public string FirstName { get; set; }
public string SecondName { get; set; }
public string Gender { get; set; }
public string Email { get; set; }
public string Mobile { get; set; }
public int EmpID { get; set; }
public Nullable<System.DateTime> DOB { get; set; }
}
}
What is missing on my code.