I have my model with:
[RequiredIfTrue("OtherField", ErrorMessage = "The field {0} cannot be blank")]
[Display(Name = "The Name")]
public string Name { get; set; }
I set the ErrorMessage
then I was expecting that, in validation, the error message was "The field The Name cannot be blank"
, but I'm getting "The The Name field is required.".
Did I miss something? Why I'm getting the default message?
PS: I don't know if makes any difference but I'm using server side validation (ModelState).
UPDATE
In the same model I have Required
(Native from .Net) being used, and Required
works well. But all RequiredIf
doesn't.