Grid in Custom Template

3 posts, 0 answers
  1. Zoran
    Zoran avatar
    10 posts
    Member since:
    Sep 2012

    Posted 20 Nov 2015 Link to this post

    I have a custom template for editing a scheduler event. In that template I have a grid to edit an array that is part of my model:

     @(Html.Kendo().Grid<Excent.Apps.Web.Solo.Models.MeetingStudentViewModel>(Model.Students)
                    .Name("StudentsGrid")
                    .Columns(columns =>
                    {
                        columns.Bound(m => m.MeetingStudentID).Hidden();
                        columns.Bound(m => m.FullName).Title("Student");
                        columns.Bound(m => m.Goals);
                    })
                    .BindTo(Model.Students)
                    .DataSource(dataSource => dataSource
                         .Ajax().ServerOperation(false)
                        .Model(model => model.Id(p => p.MeetingStudentID))
                         .Model(model => model.Field(o => o.FullName))
                         .Model(model => model.Field(o => o.Goals))
                   )

    When I display the template the grid is empty.

  2. Vladimir Iliev
    Admin
    Vladimir Iliev avatar
    2172 posts

    Posted 24 Nov 2015 Link to this post

    Hello Zoran,

    Current behavior is expected as the editor template is executed on the server side using empty instance of the Grid model and later on the client side the edited model is bind using MVVM. The correct approach would be passing the nested Grid data using the "Edit" event of the parent widget as shown in the following example:


    Regards,
    Vladimir Iliev
    Telerik
    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. Zoran
    Zoran avatar
    10 posts
    Member since:
    Sep 2012

    Posted 24 Nov 2015 Link to this post

    Thanks.
Back to Top