Updating EndDate when StartDate doesn't work

4 posts, 0 answers
  1. Erminio
    Erminio avatar
    5 posts
    Member since:
    May 2017

    Posted 22 Feb 2018 Link to this post

    Hi all,

    I'm updating EndDate value when StartDate value changes. This seems to work fine, but when I try to save the appointment the old date value appears in the EndDatePicker and I cannot save the appointment.


    Here is mycode



    function changeEndDate(sender, e) {
     var endDatePickerID = sender.get_id().replace("StartDate", "EndDate");
     var endDatePicker = $find(endDatePickerID);



    RadDatePicker startDate = (RadDatePicker)e.Container.FindControl("StartDate");
    if (startDate != null){
    startDate.ClientEvents.OnDateSelected = "changeEndDate"




    The code is copied from this link https://docs.telerik.com/devtools/aspnet-ajax/controls/scheduler/how-to/change-the-end-date-when-the-start-date-changes


    Any help on this?
    Thanks a lot

  2. Peter Milchev
    Peter Milchev avatar
    689 posts

    Posted 27 Feb 2018 Link to this post

    Hello Erminio,

    The return of the old value is unexpected and it might be related to some customizations. 

    Please find attached a sample project and a screencast demonstrating the proper behavior of the code suggested in the provided article. 

    If that does not help to resolve the issue, please modify the attached project and send it back to us as an attachment in an official support ticket for further investigation.

    Peter Milchev
    Progress Telerik
    Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
  3. Simon
    Simon avatar
    2 posts
    Member since:
    Aug 2019

    Posted 09 Oct 2019 Link to this post

    I have the same issue, but with MVC/C#/EF6 and I'm using a CustomEditor for the Scheduler.

    I've attached an event to the datetimepicker:

    @(Html.Kendo().DateTimePickerFor(model => model.Start).Events(e => e.Change("changedatetime")).HtmlAttributes(generateDatePickerAttributes("startDateTime", "start", "value:start,invisible:isAllDay")))


    And the following script on the View:

    <script type="text/javascript">
        function changedatetime() {
            var dateTimePicker = $("#startDateTime").data("kendoDateTimePicker");
            $("#endDateTime").data("kendoDateTimePicker").value(new Date(dateTimePicker.value()));

    When I update the start date the end date changes/matches, but when the Scheduler is reloaded the end date reverts back to the original date?

  4. Simon
    Simon avatar
    2 posts
    Member since:
    Aug 2019

    Posted 09 Oct 2019 in reply to Simon Link to this post

    I found the solution, after updating the end date you need to trigger the change event to force the new date to be written back to the database.

    function changedatetime() {
        var dateTimePicker = $("#startDateTime").data("kendoDateTimePicker");
        $("#endDateTime").data("kendoDateTimePicker").value(new Date(dateTimePicker.value()));
Back to Top