I have an field, Address2, which is optional. Thus if it is null, no validation rules apply. However, if a value exists, its length cannot be greater that 255 characters.
I have been toying with:
<StringLengthValidator(0, RangeBoundaryType.Inclusive, 255, RangeBoundaryType.Inclusive, MessageTemplate:="Address 2 can be between 0 and 255 characters in length.", Ruleset:="MyRules")> _
But if it's not present, I still get an error.
Any suggestions?
Thank you.