Edit in line grid on update send empty model to server

3 posts, 1 answers
  1. Marc Jr
    Marc Jr avatar
    5 posts
    Member since:
    Nov 2012

    Posted 17 Jun 2020 Link to this post

    I have a simple grid and try to get the updated row on server side but the model send is always empty

    Client side Grid (View)

    <div class="card-body">
            @(Html.Kendo().Grid<CoopTel_MultiLocation.Models.DummyModel>()
                        .Name("grid")
                        .Columns(columns =>
                        {
                            columns.Bound(p => p.Col1).Filterable(false);
                            columns.Bound(p => p.Col2);
                            columns.Bound(p => p.Col3);
                            columns.Bound(p => p.Col4);
                            columns.Bound(p => p.Col5);
                            columns.Bound(p => p.TestBooleen);
                            columns.Command(command => { command.Edit(); command.Destroy(); }).Title("Commandes").Width(250);
                        })
                        .Editable(editable => editable.Mode(GridEditMode.InLine))
                        .Pageable()
                        .Sortable()
                        .Scrollable()
                        .ToolBar(toolbar =>
                        {
                            toolbar.Search();
                            toolbar.Create();
                        })
                        .HtmlAttributes(new { style = "height:550px;" })
                        .DataSource(dataSource => dataSource
                            .Ajax()
                            .PageSize(20)
                            .Model(model => { model.Id(p => p.Col1); })
                            .Read(read => read.Action("GetLocationUI", "GestionLocation"))
                            .Update(update => update.Action("DetailLocationUpdate", "GestionLocation"))
                            .Destroy(destroy => destroy.Action("DetailLocationDestroy", "GestionLocation"))
                            .Create(update => update.Action("DetailLocationCreate", "GestionLocation"))
                        )
            )
        </div>

    GestionLocationController

            [AcceptVerbs(HttpVerbs.Post)]
            public ActionResult DetailLocationUpdate([DataSourceRequest] DataSourceRequest request, DummyModel Locations) <-- Location is always empty 
            {
                return Json("");
            }

  2. Answer
    Neli
    Admin
    Neli avatar
    432 posts

    Posted 19 Jun 2020 Link to this post

    Hi Marc,

    The provided code seems correct and I could not suggest a possible reason for the caused issue.

    Attached you will find a sample project with a Grid with inLine editing and similar configuration. May I ask you to modify the sample in order to replicate the behavior the way it is at your end and send it back to us? This way we could take a look closely and provide you further assistance. Note, that dependencies are deleted due to the size limits. 

    Looking forward for your reply.

    Regards,
    Neli
    Progress Telerik

    Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
    Our thoughts here at Progress are with those affected by the outbreak.
  3. Marc Jr
    Marc Jr avatar
    5 posts
    Member since:
    Nov 2012

    Posted 22 Jun 2020 in reply to Neli Link to this post

    thank you very much I use your simple in my code and it work perfectly. Thanks for the support
Back to Top