[my.cshtml] @Html.EJ().DatePickerFor(model => model.From, (Syncfusion.JavaScript.Models.DatePickerProperties)ViewData["date"]).Width("100%") @Html.EJ().DatePickerFor(model => model.To, (Syncfusion.JavaScript.Models.DatePickerProperties)ViewData["date"]).Width("100%") <script> function OnSelect(args) { alert("yes") var p = $("#From").ejDatePicker("instance"); var m = $("#To").ejDatePicker("instance"); if (p.model.value < m.model.value) { val = p.element.val(); p.option("value", m.element.val()); m.option("value", val); } } </script> |
Hello
It is exactly as you said, I used the wrong Id to access the DatePicker.
I just needed to use "From" instead of "FromDatePicker" ($("#From").ejDatePicker("instance")) and everything works as expected.
Thank you a lot for your help.
Kind regards
Phil