MVC 5 Grid not showing data

2 posts, 0 answers
  1. Shuja
    Shuja avatar
    30 posts
    Member since:
    Mar 2011

    Posted 16 Dec 2014 Link to this post


    I've created a simple MVC 5 project with a Kendo grid to display a few records from a remote server. When i run the application, the kendo grid appears but displays no records. 
    I checked Fiddler and found no errors or circular references. Furthermore, the JSON output shows the correct data in it but its simply not displaying in the grid. Here is the grid and controller code:

    <div style="width:830px;font-size:x-small; padding-top:40px;">
                columns.Bound(o => o.Id);
                columns.Bound(o => o.SystemName);
                columns.Bound(o => o.FormType);
                .DataSource(dataSource => dataSource
                 .Read(read => read.Action("GetMyForms", "Home"))             

    public ActionResult GetMyForms([DataSourceRequest] DataSourceRequest request)
        var query = _repository.GetMyForms(GetCurrentUserName());
        query = query.OrderBy(s => s.RequestDate);
        return Json(query, JsonRequestBehavior.AllowGet);
    public IQueryable<vMyForm> GetMyForms(string UserName)
        SystemsFormsDataContext db = new SystemsFormsDataContext();
        IQueryable<vMyForm> query;
        Int32 UserId = GetCurrentUserId(UserName);
            query = (from s in db.vMyForms
                     where s.UserId == UserId
                     select s);   
        catch (Exception ex)
            query = (from s in db.vMyForms
                     where s.UserId == 0
                     select s);
        return query;

    Could you please help me figure out what the issue is with the data not displaying in the grid?

    Thanks,  Shuja

  2. Georgi Krustev
    Georgi Krustev avatar
    3747 posts

    Posted 18 Dec 2014 Link to this post

    Hello Shuja,

    My colleague answered to the support thread opened on the same subject. I would like to continue our discussion there if the problem is still not resolved in order to avoid duplication.

    Here is a quote of the answer:

    From the provided information it appears that the Controller returns the data to the Grid in invalid format - please note that the Grid expects the records to be nested in "Data" field of the response. The easiest way to achieve this is to use the "ToDataSourceResult" extension method on the data before sending it to the client side as demonstrated in the following help article:

    Georgi Krustev

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

Back to Top