I read a lot of topics which mention that the primary purpose for DataType is displaying data and not validating data. So I tried the following for testing
public partial class test
{
public int Id { get; set; }
[DataType(DataType.EmailAddress)]
public string email { get; set; }
[DataType(DataType.Date)]
public System.DateTime date { get; set; }
}
And I have noted that both the date & email will have validation checking,For example I can not write invalid email address or invalid date format ? So my question is why a lot of topics mention that the primary purpose for DataType is used for formatting the properties and not for validating them. While in my test I found that specifying DataType for the property such as email & Date will create validation login also? Can anyone advice? Thanks