1

I'm new with MVC 4, also I'm new with .net. I tried this to validate date (didn't work):

[Required]
[DataType(DataType.Date)]
public string Bdate { get; set; }

i did see this.

i need regular expression works for 1900s and 2000s(for all dates )

please help me.(please regular expression answer)

Community
  • 1
  • 1
Muath
  • 4,351
  • 12
  • 42
  • 69

1 Answers1

4
[Required]
[DataType(DataType.Date)]
[Range(typeof(DateTime),"1-Jan-1940","1-Jan-2000")]
public string Bdate { get; set; }
Bashar Abu Shamaa
  • 1,998
  • 2
  • 21
  • 36