I try to change the message default from @Html.ValidationMessageFor. Where is the file who i can chage the message: The _nameFied field is required.
View:
@Html.ValidationMessageFor(model => model.NumDoc,"", new { @class = "error-input"})
You can do it in your modal class's specific property using the ErrorMessage property in the of Required attribute.
Ex:
public class MyClass{
[Required(ErrorMessage = "My validation error message goes here")] //give your validation message here
[Display(Name = "My display name")] //Give your display name here
public int NumDoc{ get; set; }
}
[DisplayName("My Name")] attribute on top of your property as well.[Key, Column(Order = 1)] [Display(Name = "Nº Documento")] [Required(ErrorMessage = "É obrigatório")] public int NumDoc { get; set; }