Hello Friends, I am trying to learn Kendo UI control and Hence try to Implement a Kendo Grid. my Code is: <pre>Index.cshtml</pre>
<div class="myKendoStyles"> @(Html.Kendo().Grid<TabEmp>() .Name("EmployeeKendoGrid") .Columns(c => { c.Bound(emp => emp.Name).Title("Employee Full Name").Width(75); c.Bound(emp => emp.DOB).Width(50).Title("Date of Birth"); c.Bound(emp => emp.Gender).Width(50); }) .Navigatable() .Scrollable() .Resizable(r => r.Columns(true)) .Pageable(pageable => pageable .Refresh(true) .PageSizes(true) .ButtonCount(5)) .DataSource(datasource => datasource .Ajax().Model(model => { model.Id(emp => emp.ID); model.Field(emp => emp.ID).Editable(false); }).Read(read => read.Action("Employee_Read", "Emps"))) ) </div>
public ActionResult Employee_Read([DataSourceRequest]DataSourceRequest request) { return Json(GetEmployees().ToDataSourceResult(request)); }
private static IEnumerable<TabEmp> GetEmployees() { var dnent = new TestDB2014Entities(); var data = dnent.TabEmps.AsEnumerable().Select(emp => new TabEmp() { ID = emp.ID, Name = emp.Name, DOB = emp.DOB, Gender = emp.Gender } ); return data; }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)