Hi there
I have a model with a property marked up like this.
[Required]
[EmailAddress]
[Display(Name =
"Username"
, ResourceType =
typeof
(MyResource))]
public
string
Username {
get
;
set
; }
The display name of the username property maps to a string "Email".
When i leave the field in the grid blank and update the row, a validation message is shown that correctly says "Email is required."
If i provide an invalid email address and update the row, a validation message is shown that incorrectly says "Username is not valid email"
I have tried applying my own validation message to the Username property with the following modifications to the model.
[Required]
[EmailAddress(ErrorMessageResourceName =
"InvalidEmail"
, ErrorMessageResourceType =
typeof
(MyResource))]
[Display(Name =
"Username"
, ResourceType =
typeof
(MyReouce))]
public
string
Username {
get
;
set
;}
Both of the above scenarios produce the same results with the above modifications.
What should the expected behavior be for the email validation message? (e.g use property name or display name attribute)
How do i provide a custom message for the email validation?