is there a way for me to override the message from Html.ValidationMessageFor.
So when it is activated, it will display the new message ?
I have tried to add this to my model:
[Required(ErrorMessage = "validation error message goes here")]
public decimal Average { get; set; }
but that wont work.
and if i add the message to the html it self, it will display it always on page load:
@Html.ValidationMessageFor(x => x.Average, "validation error message goes here", new { @class = "text-danger" })
I need to change the error message provided for my language (danish) instead of just the model name which is in english.
[Required(ErrorMessage = "...")]does not work. But you can use resource files to localize your error messages - refer this blog for an example