I have a model with a property defined like this:
[Required(ErrorMessage="Please enter how many Stream Entries are displayed per page.")]
[Range(0,250, ErrorMessage="Please enter a number between 0 and 250.")]
[Column]
public int StreamEntriesPerPage { get; set; }
This works unless the user enters something like "100q". Then a rather ugly error is displayed that says "The value '100q' is not valid for StreamEntriesPerPage."
Is there an attribute I can use to override the default error message when input is not an int?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…