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

DateInput Compare Validator with 4.5 Unobtrusive Validation

1 Answer 34 Views
Input
This is a migrated thread and some comments may be shown as answers.
Mark
Top achievements
Rank 1
Mark asked on 05 Aug 2013, 05:05 PM
I am following the example shown at this link but trying to utilize unobtrusive validation found in .Net 4.5.  No matter what I get the validator showing me that the values I have entered are improper.  The compare validator works great with the Currency and Numeric input controls so the issue seems to be specific to the DateInput control.  

I dug into the actual Microsoft WebUIValidation.js file to try and see what may the issue and it appears they use a couple regular expressions to try and determine whether the date part is the first digits or the last.  But for some reason it never matches either regex so the values come back as not valid.  The value it retrieves it appears is "2013-08-30-00-00-00"  if i edit that value while debugging to remove the trailing zero's then (which I assume are for time?) then the validator works properly.

1 Answer, 1 is accepted

Sort by
0
Vasil
Telerik team
answered on 08 Aug 2013, 02:44 PM
Hi Mark,

You can use the String Type of the validator, because in "yyyy-MM-dd-HH-mm-ss" format, if the date is smaller than other date, its string representation will also be smaller. So no need to use the Date format.

The RadDateInput and RadDatePicker will always pass the value in such format, regardless of the users culture or the display format.

Regards,
Vasil
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
Tags
Input
Asked by
Mark
Top achievements
Rank 1
Answers by
Vasil
Telerik team
Share this question
or