locked
ASP.Net MVC3 View with Kendo Grid Control rendering data in Json format RRS feed

  • Question

  • User248087600 posted

    Hi all,

    Scenario:

    I am using kendo grid for binding and displaying data from database. but Json formatted data of Product table record getting rendered on browser. I am expecting data in kendo Grid.

    this is my controller code

    public ActionResult Products_Read([DataSourceRequest]DataSourceRequest request)
    {
    using (var northwind = new NorthwindEntities())
    {
    IQueryable<Product> products = northwind.Products;
    DataSourceResult result = products.ToDataSourceResult(request);
    return Json(result);
    }
    }

    and this is my view code

    @(Html.Kendo().Grid<KendoGridAjaxBinding.Models.Product>()
    .Name("grid")
    .DataSource(dataSource => dataSource 
    .Ajax() 
    .Read(read => read.Action("Products_Read", "Home")) 
    )
    .Columns(columns =>
    {
    columns.Bound(product => product.ProductID);
    columns.Bound(product => product.ProductName);
    columns.Bound(product => product.UnitsInStock);
    })
    .Pageable() 
    .Sortable() 
    )

    Please help me to resolve the same.

    Thanks.

    Friday, August 14, 2015 6:50 AM

Answers

All replies