All grids stopped showing the data

9 posts, 1 answers
  1. Reid
    Reid avatar
    448 posts
    Member since:
    Oct 2008

    Posted 16 Apr 2018 Link to this post

    I have like 17 grids on templates that display and service the CMS portion of a site.  Until I noticed today, all grids were functioning fine for display and crud operations.  Now the grids do not show the data.

    I can put a breakpoint at the end of the read function and see that the data is there.

    IQueryable<Product> res = viewModel.Products.AsQueryable<Product>();
    DataSourceResult data = res.ToDataSourceResult(request);           
    JsonResult result = Json(data);
     return Json(data);

     

    So as the Read functions exit they have their data but the grids do not display anything!  I have been working in an entirely different area on the retail part of the site over the last few days that has nothing to do with Telerik and have not changed any of the code on that controller or associated views that have to do with the CMS portion.  I am completely stumped on this one

    Any suggestions would greatly help.  This is an important issue that has the CMS side of the site down.

    Thanks

     

     

     

     

     

  2. Reid
    Reid avatar
    448 posts
    Member since:
    Oct 2008

    Posted 18 Apr 2018 in reply to Reid Link to this post

    I discovered the problem. First of all this application is an ASP.NET MVC Core application and initializes the application and container in the Startup.cs.  In the service configuration section I altered something in trying to resolve a serialization/deserialization issue.  After adding back the DefaultContractResolver in the option settings for JSON the data returned to the display.

     services.AddMvc()
     // Maintain property names during serialization.  
     .AddJsonOptions(options => options.SerializerSettings.ContractResolver = new DefaultContractResolver());

     

     

  3. Answer
    Viktor Tachev
    Admin
    Viktor Tachev avatar
    2501 posts

    Posted 18 Apr 2018 Link to this post

    Hello Reid,

    The most likely cause of the behavior you are seeing is the way data is serialized by .NET Core. By default the fields will be serialized in camelCase and the Grid component will usually expect them to be in PascalCase. In order to avoid this it is recommended to change the serialization settings.

    Please check out step 5 in the article below that shows how you can configure the option.



    Regards,
    Viktor Tachev
    Progress Telerik
    Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
  4. Reid
    Reid avatar
    448 posts
    Member since:
    Oct 2008

    Posted 20 Apr 2018 in reply to Viktor Tachev Link to this post

    Thanks for this response.  That article covers this topic well.
  5. Chayady
    Chayady avatar
    2 posts
    Member since:
    Nov 2019

    Posted 01 Jan 2020 in reply to Viktor Tachev Link to this post

    Dear Viktor,

    Is your answer (and the link) still valid (as of 2 Jan 2020)?

    The link (step 5) mention about "Add the Kendo UI services to the services container".

    I have done that but it still not working.

    I have confirmed that json data has been passed, but kendo grid didn't show it.

    i.e: json: id: "f9238530-712c-43c8-b1a7-0c0887f7743d" but my column: columns.Bound(p => p.Id);

    I am using net core 3.1

    Thanks in advance.

  6. Chayady
    Chayady avatar
    2 posts
    Member since:
    Nov 2019

    Posted 01 Jan 2020 in reply to Chayady Link to this post

    Sorry, found the answer: 

    https://www.telerik.com/forums/inline-grid-not-showing-records

    https://docs.telerik.com/kendo-ui/knowledge-base/grid-is-not-showing-data

    public void ConfigureServices(IServiceCollection services){...// Maintain property names during serialization. See:// https://github.com/aspnet/Announcements/issues/194 services .AddMvc().AddJsonOptions(options => options.SerializerSettings.ContractResolver = new DefaultContractResolver());// Add Kendo UI services to the services container services.AddKendo();}

  7. Viktor Tachev
    Admin
    Viktor Tachev avatar
    2501 posts

    Posted 06 Jan 2020 Link to this post

    Hello,

     

    The structure of the linked article was changed a bit. The relevant information is available in the JSON Serialization section linked below:

    https://docs.telerik.com/aspnet-core/getting-started/prerequisites/environment-support#json-serialization

     

    Regards,
    Viktor Tachev
    Progress Telerik

    Get quickly onboarded and successful with Telerik UI for ASP.NET Core with the dedicated Virtual Classroom technical training, available to all active customers.
  8. s_guryev
    s_guryev avatar
    7 posts
    Member since:
    Oct 2012

    Posted 29 Jan in reply to Viktor Tachev Link to this post

    Hello Victor.
    I have added contract resolver which didn't help

    I can see details in the response with the correct case

    My grid is so simple:

    @(Html.Kendo().Grid<AppUserModel1>()
    .Name("grid_users1")
    .Height(200)
    .Columns(columns =>
    {
    columns.Bound(m => m.Email);
    })
    .DataSource(ds => ds
    .Ajax()
    .Model(m =>
    {
    m.Id(u => u.Id);
    m.Field(u => u.Email).Editable(false);
    })
    .Read(r => r.Action("Get", "User").Type(HttpVerbs.Get))
    .Update(u => u.Action("Put", "User").Type(HttpVerbs.Put))
    )
    .Deferred())

  9. s_guryev
    s_guryev avatar
    7 posts
    Member since:
    Oct 2012

    Posted 30 Jan in reply to s_guryev Link to this post

    My bad. I have forgotten await before returning ToDataSourceResult
Back to Top