DateInput Compare Validator with 4.5 Unobtrusive Validation

2 posts, 0 answers
  1. Mark
    Mark avatar
    10 posts
    Member since:
    Jul 2013

    Posted 05 Aug 2013 Link to this post

    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.
  2. Vasil
    Vasil avatar
    1604 posts

    Posted 08 Aug 2013 Link to this post

    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.

    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.
Back to Top