[RESOLVED]How to do intelligente date of birth like facebook

Hi, today i got anly a text bow where user set them birthday date with datapicker..

In stead i would love to do like facebook and make my user choosing from a select boxes DAY , MONTH and YEAR…

the problem is… like this, how can i check if the date is right?

any wroking example?

PC this data fileld is held in the common users table ov MVC5

you can define custom helper method, annotation, binding and client validation

check this link

http://stackoverflow.com/questions/11475670/how-to-validate-a-date-using-3-dropdowns-day-month-year-using-jquery-unobtr

Hi, there is not anohter easier way?

Thanks

Hi grafic,

For this requirement, you could use DataType attribute, for example:

[Display(Name = "My Date:")]
        [DataType(DataType.Date, ErrorMessage="validate time")]  
        [Required]
        public System.DateTime MyDate { get; set; }

Note: that base on the culture to validate the data.

For example:

 protected void Application_BeginRequest(object sender, EventArgs e)
        {
            CultureInfo culture = new CultureInfo("en-Us");
            Thread.CurrentThread.CurrentCulture = culture;
            Thread.CurrentThread.CurrentUICulture = culture;
        }

# Globalize and jQuery Validation

http://icanmakethiswork.blogspot.com/2012/09/globalize-and-jquery-validate.html

Best Regards

Starain Chen

Leave a Reply