I am using DAValidation in my asp.net application, I have to apply Numeric validation on contact number, also on the length on contact number which should be minimum 11 digits.
This is how I am applying annotation
[StringLength(20, MinimumLength = 11, ErrorMessage = "Contact number should have minimum 11 digits")]
[Range(0, Int64.MaxValue, ErrorMessage = "Contact number should not contain characters")]
public string CONTACT_NUMBER
{
get { return m_CONTACT_NUMBER; }
set
{
m_CONTACT_NUMBER=value;
}
}
It is working fine,but the problem I am facing is that if I enter abc in contact number field,it will check for length first(ie it gives error message (Contact number should have minimum 11 digits)), However it should validate the datatype incase of non numeric input.
How can I fix this?
What I have tried:
[StringLength(20, MinimumLength = 11, ErrorMessage = "Contact number should have minimum 11 digits")]
[Range(0, Int64.MaxValue, ErrorMessage = "Contact number should not contain characters")],/pre>