Custom editor

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

    Posted 17 Nov 2015 Link to this post

    This is part of my custom editor:

    <div data-container-for="studentID" class="k-edit-field">
        @(Html.Kendo().ComboBoxFor(model => model.StudentID)
              .HtmlAttributes(new { data_bind = "value:StudentID" })
              .Placeholder("Start typing student's name...")
              .Text(Model.StudentID != null ? Model.Title : "")
              .DataSource(source =>
                  source.Read(read =>
                      read.Action("GetStudents", "Student").Data("filterStudents");
              .Events(e =>
    <div data-container-for="title" class="k-edit-field">
        @(Html.HiddenFor(model => model.Title, new { id = "TitleId", data_bind = "value:title" }))


    I am trying to set the title with the text from the combobox:

         function onStudentSelected(e) {
            var dataItem = this.dataItem(e.item.index());

      Alert on $("#TitleId").val()  shows that it is set. But when I save the template the value is not passed to the server.

    I have also made Title just a standard textboxfor so that I can see that the value is set.

    Why is this not persisting to the model?


    Also, this is my schduler:

        .Views(views =>
            views.DayView(dw => dw.DateHeaderTemplate("#=kendo.toString(date, 'd')#")).ShowWorkHours(true);
            views.WeekView(weekView => weekView.DateHeaderTemplate("#=kendo.toString(date, 'MM/dd')#").SelectedDateFormat("{0:MM/dd/yyyy} to {1:MM/dd/yyyy}")).ShowWorkHours(true).Selected(true);
            views.AgendaView(aw => aw.Title("Session").SelectedDateFormat("{0:MM/dd/yyyy} to {1:MM/dd/yyyy}"));
            .Editable(editable =>
        .DataSource(d => d
            .Model(m =>
                m.Id(f => f.MeetingID);
                m.Field(f => f.Start);
                m.Field(f => f.End);
                m.Field(f => f.IsAllDay);
                m.Field(f => f.Title);
                m.Field(f => f.RecurrenceRule);
                m.Field(f => f.Description);
                m.Field(f => f.StudentID);
                m.Field(f => f.ProcedureCode);
                m.Field(f => f.Color);
                m.RecurrenceId(f => f.RecurrenceID);
            .Events(e => e.Error("error_handler"))
                .Read("Meetings_Read", "ProviderHome")
                    .Create("Meetings_Create", "ProviderHome")
                    .Destroy("Meetings_Destroy", "ProviderHome")
                    .Update("Meetings_Update", "ProviderHome")



  2. Vladimir Iliev
    Vladimir Iliev avatar
    2156 posts

    Posted 19 Nov 2015 Link to this post

    Hello Zoran,

    As the editors inside the edit template are bind to the model using MVVM you should also manually trigger the "change" event of the target editor after setting it's value in order the change to be propagated to the model. Please check the example below:


    Vladimir Iliev
    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 AJAX banner
Back to Top