3
[MetadataType(typeof(PersonMetaData))]
public partial class Person {
    public class PersonMetaData {
        [Required(ErrorMessage="The number is required")]
        public object Number {get;set;}
    }
}

This error message is shown when the number field is empty and when there's an invalid input it gives "The value 'foo' is not valid for Number.". How can I customize the latter error message?

randomguy
  • 12,042
  • 16
  • 71
  • 101
  • possible duplicate of [ASP.NET MVC - Custom validation message for value types](http://stackoverflow.com/questions/646270/asp-net-mvc-custom-validation-message-for-value-types) – Andre Pena Aug 26 '12 at 17:00

1 Answers1

2

ASP.NET MVC - Custom validation message for value types

Community
  • 1
  • 1
randomguy
  • 12,042
  • 16
  • 71
  • 101