2

I have this propery in my C# class:

[Required]
[RegularExpression("^[0-9]*$", ErrorMessage = "Document must contain only numbers")]
public string DocRegister{ get; set; }

Beyond that, I need to validade the length of the string. It's acceptable the length 11 OR 14
How can I do that with Data Annotations?

I mean, I couldn't do:

[StringLength(11, MinimumLength = 11)]
[StringLength(14, MinimumLength = 14)]

right?

hyfronx
  • 23
  • 4

0 Answers0