我尝试从@Html.ValidationMessageFor
更改消息默认值。我可以在哪里查找邮件的文件:The _nameFied field is required.
查看:
@Html.ValidationMessageFor(model => model.NumDoc,"", new { @class = "error-input"})
答案 0 :(得分:7)
您可以使用Required
属性中的ErrorMessage property在模态类的特定属性中执行此操作。
例如:
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; }
}