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

.

Display Name
  • 4,672
  • 1
  • 33
  • 43
Sachin Kainth
  • 45,256
  • 81
  • 201
  • 304

1 Answers1

1

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

Hope that helps. Thanks.

Community
  • 1
  • 1
Display Name
  • 4,672
  • 1
  • 33
  • 43