[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


Hi, there is not anohter easier way?


Hi grafic,

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

[Display(Name = "My Date:")]
        [DataType(DataType.Date, ErrorMessage="validate time")]  
        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


Best Regards

Starain Chen

Leave a Reply