This is a migrated thread and some comments may be shown as answers.

Kendo DatePicker change event doesn't fire on change

1 Answer 791 Views
Date/Time Pickers
This is a migrated thread and some comments may be shown as answers.
Joey
Top achievements
Rank 1
Joey asked on 04 Jan 2017, 12:42 AM

I have replicated this in the sample project attached.

Simply put, change events on the Kendo DatePicker control (created by the MVC wrapper), fire immediately upon loading the page, but do not fire when the date value of the control is changed.

1 Answer, 1 is accepted

Sort by
0
Patrick | Technical Support Engineer, Senior
Telerik team
answered on 04 Jan 2017, 03:56 PM
Hi Joey,

First, thank you for the sample project replicating the issue.  That helps!

After reviewing your code, I believe the issue is the way you set your event handlers.  There are 2 ways you can set it:

1.  By the Handler Name:

For the change event to fire using a handler name, set the change event like the following:
@(Html.Kendo().DatePicker()
    ...
    .Events(e =>
    {
        e.Change("change");
    })
)
 
<script>
    function change() {
        console.log("Changed!");
    }
</script>

2. By Template Delegate:

The following shows how to subscribe to the change event by template delegate:
@(Html.Kendo().DatePicker()
    ...
    .Events(e =>
    {
         e.Change(
            @<text>
            function(e) {
                console.log("Changed!");
            }
            </text>
    );
})
)

I've attached an updated project using both styles.  The Change event is using the Handler Name, and the Open event uses the Template Delegate.

Hope this helps!

Regards,
Patrick
Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
Date/Time Pickers
Asked by
Joey
Top achievements
Rank 1
Answers by
Patrick | Technical Support Engineer, Senior
Telerik team
Share this question
or