I tried to use Required DataAnnotation on Start and End properties of my viewmodel to validate DateRangePicker.
But seems like it is not working by default.
Any suggestion on validating DateRangePicker control?
1 Answer, 1 is accepted
0
Nikolay
Telerik team
answered on 17 Feb 2020, 03:09 PM
Hello Hugo,
It is possible to add a min and max settings and when the input is blurred, it will set the closest date to either min or max if the user tried to enter an invalid date:
As for the required validation, currently, it is a little complex because the inputs have no name but still could be achieved. Here are the steps:
- add names to the inputs of the Kendo UI DateRangePicker and validation message attributes - add the validateOnBlur: false setting to the Kendo UI Validator because the ranges are not yet updated on blur and neither is the input - add a change event handler to the DateRangePicket and call the validator validate() method
I have prepared a small Dojo demo demonstrating the above:
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers.Learn More.