Grid does not render with Commands

7 posts, 0 answers
  1. Dan
    Dan avatar
    24 posts
    Member since:
    Jun 2020

    Posted 27 Jan Link to this post

    I am attempting to create a grid that has the Edit (Update) command available.

    When I run the application with the edit options commented out it renders, but when I leave them in I get no errors on the front end and the page is blank. The read controller is not even being hit.

    Here is the view code. Any ideas? It seems adding the Edit options somehow breaks the grid.

     

    @using Kendo.Mvc.UI
     
    @(Html.Kendo().Grid<HoldingOvenEditor.Models.HOGridModel>()
                .Name("grid")
                .Columns(columns =>
                {
                    columns.Bound(p => p.OvenName);
     
                    columns.Command(command => { command.Edit(); }).Width(160); //<= Comment this out to work correctly
                })
                .Editable(editable => editable.Mode(GridEditMode.PopUp)) //<= Comment this out to work correctly
                .DataSource(dataSource => dataSource
                    .Ajax()
                    .Model(model => {
                        model.Id(p => p.OvenName);
                        model.Field(x => x.OvenName).Editable(true);
     
                    })
                    .Read(read => read.Action("ResourceGrid_Read", "Grid"))
                    .Update(update => update.Action("EditingPopup_Update", "Grid")) //<= Comment this out to work correctly
     
        )
    )
  2. Anton Mironov
    Admin
    Anton Mironov avatar
    204 posts

    Posted 01 Feb Link to this post

    Hello Dan,

    Thank you for the code snippet and details.

    I tried to replicate the faulty behavior and created the same Kendo UI Grid. The PopUp Editing and Read methods are working as expected.

    Find attached a sample project with the needed implementation. Try to replicate the issue and send it back to me in this thread. Another approach is to provide a runnable, isolated, sample project. Examining this project will let us replicate the issue locally and further troubleshoot it.

    Looking forward to hearing back from you.

     

    Kind Regards,
    Anton Mironov
    Progress Telerik

    Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

  3. Dan
    Dan avatar
    24 posts
    Member since:
    Jun 2020

    Posted 01 Feb in reply to Anton Mironov Link to this post

    Anton,

    For some odd reason when I attempt to run the same you provided, the project properties are targeting .net framework and will not allow me to target .net core. Not sure whats going on there.

    I can't really provide you with a sample of the current project without creating a brand new one and making things generic because of company policy. In that event I would bet it works. (I have other .net core 3.1 MVC projects and they are working fine with grid rendering)

    Is there any common issues with rendering I can try to resolve before I give up and just make a new project file?

  4. Dan
    Dan avatar
    24 posts
    Member since:
    Jun 2020

    Posted 01 Feb in reply to Dan Link to this post

    My bet was wrong. A fresh project still will not render a grid with edit capabilities enabled. The HTML just is missing if inspected in dev tools. Like half the document was just deleted.
  5. Anton Mironov
    Admin
    Anton Mironov avatar
    204 posts

    Posted 04 Feb Link to this post

    Hello Dan,

    Could you please send me back in this thread the newly created project. Examining this project will let us replicate the issue locally and further troubleshoot it.

    A possible reason for the issue with opening my project is that its target framework is .NET 5.0

    Looking forward to hearing back from you.

    Once I have your sample project, I will try my best to resolve this one quickly for you.

     

    Best Regards,
    Anton Mironov
    Progress Telerik

    Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

  6. Dan
    Dan avatar
    24 posts
    Member since:
    Jun 2020

    Posted 08 Feb in reply to Anton Mironov Link to this post

    Anton,

    I figured this issue out. I didnt realize (should have) that when using the edit capability you need to make sure your model has a parameter less constructor. Mine had an overridden constructor but I did not explicitly declare a parameter less one so I assume it was erroring somewhere along the line. I did not receive any error from Telerik though so I had to dig to find this.

     

    Thanks

  7. Anton Mironov
    Admin
    Anton Mironov avatar
    204 posts

    Posted 11 Feb Link to this post

    Hello Dan,

    Thank you for sharing with the community the fix for this case.

    This is a tricky one and could not be handled without the project available locally.

    Thank you again. If further assistance is needed, do not hesitate to contact me and the team.

     

    Greetings,
    Anton Mironov
    Progress Telerik

    Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Back to Top