1

I have a field to which I want to apply the System.ComponentModel.DataAnnotations.RangeAttribute to thus

[Range(0, Int32.MaxValue)]

But I'd like this field to be a string because there is another value that I'd like it be able to have and that is "Unlimited". Is there some attribute or combination of attributes I can use to say "allow any positive integer or the string "Unlimited"?

Thanks,

Sachin

.

1 Answer 1

1

Try using regular expression like in this question: RegEx that matches positive numbers

Hope that helps. Thanks.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.