Click here to Skip to main content
15,888,527 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
XML
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>

XML
<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>



C#
public ActionResult Employee_Read([DataSourceRequest]DataSourceRequest request)
        {

             
                return Json(GetEmployees().ToDataSourceResult(request));

        }




C#
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;
}


but Instead of showing result in Kendo Grid , it just display JSon Data.
Posted
Updated 11-Jun-15 4:47am
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900