Using 2016.2.630 preview - Data not displayed

8 posts, 0 answers
  1. Peter
    Peter avatar
    22 posts
    Member since:
    Nov 2007

    Posted 05 Jul Link to this post

    I'm trying to work the new preview version for .net core 1.0.  However, the issue I'm having is that the grids will not display any data when using the MVC version.  If I create the grid using the javascript version, it works.

    Both grids call the same function and both return data.  However, only Grid2 displays any data. 

    Using the KendoUI Chrome plugin, the Kendo Linter gives me two errors on Grid1.

    http://localhost:20504/:92,944 Unknown option: prefix
    http://localhost:20504/:92,1146 Unknown option: fields

    Also, inspecting the grid, the _data for Grid1 shows Array[0], while the _data for Grid2 shows Array[1].

    <h1>Grid 1</h1>
    @(Html.Kendo().Grid<TelerikCoreTest1.Model.GridModel>()
        .Name("Grid1")
        .Columns(col =>
        {
            col.Bound(x => x.Id);
            col.Bound(x => x.Text);
     
        })
        .DataSource(ds => ds
            .Ajax()
            .Read(rd => rd.Action("Grid_Read", "Home"))
        )
        .Deferred()
    )
     
    <br />
     
    <h1>Grid 2</h1>
     
    <div id="Grid2"></div>
     
    @section scripts {
     
        <script>
            var readUrl = '@Url.Action("Grid_Read", "Home")'
     
            $("#Grid2").kendoGrid({
                height: 400,
                columns: [{ title: "Id", field: "id" },
                    {title: "Text", field: "text"}
                ],
                dataSource: {
                    transport: {
                        read: readUrl
                    },
                    schema: {
                        data: "data"
                    }
                }
            });
        </script>
     
        @Html.Kendo().DeferredScripts()
    }

    public IActionResult Grid_Read([DataSourceRequest]DataSourceRequest request)
    {
        List<GridModel> data = new List<Model.GridModel>();
     
        GridModel gm = new GridModel()
        {
            Id = 1,
            Text = "Testing"
        };
     
        data.Add(gm);
     
        return Json(data.ToDataSourceResult(request));
    }

  2. Dimo
    Admin
    Dimo avatar
    8333 posts

    Posted 08 Jul Link to this post

    Hello Peter,

    There is a breaking change in ASP.NET Core, related to how the JSON serializer works. Specific details and suggestions on how to proceed are provided at:

    https://github.com/telerik/kendo-ui-core/issues/1856#issuecomment-229874309

    https://github.com/telerik/kendo-ui-core/issues/1856#issuecomment-230450923

    The server-defined Grid renders a schema.data setting value of "Data", while the server response contains a "data" field. As a result, the client-side Kendo UI DataSource instance cannot parse the response and extract the data items.

    Regards,
    Dimo
    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
  3. UI for ASP.NET MVC is VS 2017 Ready
  4. Peter
    Peter avatar
    22 posts
    Member since:
    Nov 2007

    Posted 08 Jul Link to this post

    Dimo,

    Thanks for the info.  That fixed the issue for me. 

  5. Michel
    Michel avatar
    18 posts
    Member since:
    Sep 2011

    Posted 26 Oct in reply to Dimo Link to this post

    Got the same problem with .914 version and solve with the serializer settings.

    Would be interesting to update the ui-for-aspnet-mvc-6-demos-rc2-final with the startup.cs modified for solving the json serialize problem.

        services.AddMvc()

    .AddJsonOptions(options => options.SerializerSettings.ContractResolver = new DefaultContractResolver()); 

  6. Dimo
    Admin
    Dimo avatar
    8333 posts

    Posted 26 Oct Link to this post

    Hi Michel,

    I am not sure which demos project you are referring to, but in case it is this one:

    https://github.com/telerik/ui-for-aspnet-mvc-6-demos

    ... it has been deprecated and is no longer maintained. 

    The current official ASP.NET Core examples that we ship in the installer, contain the discussed fix.

    Regards,
    Dimo
    Telerik by Progress
    Check out the new UI for ASP.NET Core, the most complete UI suite for ASP.NET Core development on the market, with 60+ tried-and-tested widgets, based on Kendo UI.
  7. Michel
    Michel avatar
    18 posts
    Member since:
    Sep 2011

    Posted 26 Oct in reply to Dimo Link to this post

    Thank you for your reply.

    No I refer to samples I've downloaded elsewhere from  Telerik named actually "ui-for-aspnet-mvc-6-demos-rc2-final".

    When installing the .914 version I did not check Samples and after trying to update the installation with the samples, I did not find them in the installation path. Are these samples source available for download elsewhere  (Telerik or Github) ?

    Best regards.

  8. Dimo
    Admin
    Dimo avatar
    8333 posts

    Posted 27 Oct Link to this post

    Hello Michel,

    Most probably you have downloaded the demos from NuGet or GitHub, but in either case, these demo packages were maintained before ASP.NET Core / MVC6 became official.

    Currently the source of MVC examples is the installer, downloadable from telerik.com.

    I tested the .914 msi installer for UI for ASP.NET MVC and the offline examples were successfully added on a subsequent install, when the "Change" option was used (not "Repair"). The exact location is:

    C:\Program Files (x86)\Telerik\UI for ASP.NET MVC R3 2016\wrappers\aspnetmvc\Examples

    Alternatively, download a ZIP installer for UI for ASP.NET MVC and extract the demos from it manually, from the same nested folder, as shown above.

    Regards,
    Dimo
    Telerik by Progress
    Check out the new UI for ASP.NET Core, the most complete UI suite for ASP.NET Core development on the market, with 60+ tried-and-tested widgets, based on Kendo UI.
  9. Michel
    Michel avatar
    18 posts
    Member since:
    Sep 2011

    Posted 27 Oct in reply to Dimo Link to this post

    Hi Dimo,

    I'm very confuse these samples are at the right place in the wrappers directory. I didn't event know it was were the samples are installed.

    Thanks for the clarification, it enhance my skills:)

    Best regards.

Back to Top
UI for ASP.NET MVC is VS 2017 Ready