If I have the following:
[Range(0,120)]
public int QtyOnHand { get; set; }
How can I add an error message to say the required range?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The
RangeAttributehas anErrorMessagethat you can set:By using
{1}and{2}, you don’t have to keep changing the string when your numbers change.{0}is for the name of the field. This can be accompanied with theDisplayNameAttributeas such: