Grid Issues

3 posts, 0 answers
  1. Nick
    Nick avatar
    2 posts
    Member since:
    Aug 2016

    Posted 12 Oct Link to this post

     

     

    I can't seem to figure out why my grid doesn't show data. Here's the Contoller code:

    public JsonResult PopulateGrid()
    {
    var x = (from n in dbContext1.GetOrders("Melody Devoe") select n);
    List<string> items = new List<string>();
    foreach (var item in x)
    {
    items.Add(item.ToString());
    }

    return Json(items.ToList(), JsonRequestBehavior.AllowGet);

    }

     

    Here's the cshtml:

    <div class="a">
    @(Html.Kendo().Grid<CentralBilling.Models.GetOrders_Result>()
    .Name("gridRater")
    .DataSource(datasource => datasource
    .Ajax()
    .Read(read => read.Action("PopulateGrid", "Home")))
    .Columns(columns =>
    {
    columns.Bound(o => o.Order_Number);
    //columns.Bound(o => o.ActDate);
    //columns.Bound(o => o.Agent_Role);
    //columns.Bound(o => o.aom_shipment_type);
    //columns.Bound(o => o.Delay);
    //columns.Bound(o => o.DeadlineDist);
    //columns.Bound(o => o.DistStatus);
    //columns.Bound(o => o.SubmitDate);
    //columns.Bound(o => o.LastAct);
    //columns.Bound(o => o.LastComment);
    })
    .Sortable()
    .Scrollable()
    .Filterable()
    .Selectable()
    )
    </div>

    I'm using a stored procedure pulled in through the Model. At first I had trouble with the proc parameter so I hardcoded one and still no luck. This is driving me crazy! Thanks in advance

  2. Nick
    Nick avatar
    2 posts
    Member since:
    Aug 2016

    Posted 12 Oct Link to this post

    Here's a photo of my model
  3. UI for ASP.NET MVC is VS 2017 Ready
  4. Marin
    Admin
    Marin avatar
    1045 posts

    Posted 14 Oct Link to this post

    Hi,

    When using .Ajax() binding for the grid you have to use the ToDataSourceResult() method in the controller's Read method as shown in this help article:
    http://docs.telerik.com/kendo-ui/aspnet-mvc/helpers/grid/binding/ajax-binding#configuration
    and this online demo:
    http://demos.telerik.com/aspnet-mvc/grid/index

    I hope this helps. Let me know if you have any other questions.

    Regards,
    Marin
    Telerik by Progress
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top