Kendo Grid Inline edit kendo timepicker not changing value

3 posts, 0 answers
  1. Adil
    Adil avatar
    26 posts
    Member since:
    Mar 2014

    Posted 04 Mar 2020 Link to this post

    Hi I have grid with inline editing when i want to click cell to update i can see my timepicker and i can select value but when i pass next cell value is disappearing and not select or changing anything
    How can i solve it?

    @( Html.Kendo().Grid<MockUpForeNet.Controllers.CardDetailController.Days>()
             .DataSource(d => d.Ajax().Read("TimeGridBinding", "CardDetail", new { rule = rule }).Update("UpdateTime","CardDetail").Model(keys =>
           keys.Id(k => k.DayId);
           keys.Field(c => c.DayName).Editable(false);
           keys.Field(c => c.DayId).Editable(false);
           keys.Field("TimeStart", typeof(string)).Editable(true);
           keys.Field("TimeEnd", typeof(string)).Editable(true);
                   .Columns(c =>
                        c.Bound(p => p.DayId).Width(100).Title(" ").ClientTemplate("#= chk2(data) #").Sortable(false);
                        c.Bound(e => e.DayName).Width(200).Title("Day");
                        c.Bound(e => e.TimeStart).Width(200).Title("Start Time").EditorTemplateName("StartTimeEditor");
                        c.Bound(e => e.TimeEnd).Width(200).Title("End Time").EditorTemplateName("EndTimeEditor");
                   .ToolBar(commands =>
                        commands.Save().SaveText(" ").CancelText(" ");
           .Editable(editing => editing.Mode(Kendo.Mvc.UI.GridEditMode.InCell))
  2. Adil
    Adil avatar
    26 posts
    Member since:
    Mar 2014

    Posted 04 Mar 2020 Link to this post

    Sorry I Posted some missing data

    Here my Template 

    Here my model
        public class Days
            public int DayId { get; set; }
            public string DayName { get; set; }
            public DateTime TimeStart { get; set; }
            public DateTime TimeEnd { get; set; }
    Here example of how to bind data
                        Days d = new Days();
                        d.DayId = 1;
                        d.DayName = "Monday";
                        d.TimeStart = Convert.ToDateTime("00:00");
                        d.TimeEnd = Convert.ToDateTime("23:59");
  3. Nikolay
    Nikolay  avatar
    323 posts

    Posted 06 Mar 2020 Link to this post

    Hello Adil,

    Thank you for sharing the Grid declaration.

    I have examined the code and may have found what is causing this issue. The DatePicker name is set to "txtend" but the grid does not have a column with such a field, the field name seems to be "TimeStart". When such a mismatch occurs the binding will fail to work thus the value from the picker will not be sent to the controller. 

    As a possible resolution I would suggest using a DatePickerFor as shown below:

    @model DateTime
    @Html.Kendo().DatePickerFor(m => m)

    For your convenience, I am attaching a small MVC Grid demo demonstrating the above. Let me know if you have any questions.

    Progress Telerik

    Get quickly onboarded and successful with your Telerik UI for ASP.NET MVC with the dedicated Virtual Classroom technical training, available to all active customers.
Back to Top