Why RangeValidator and RegularExpression cannot validate nullvalues??

  • Thread starter Thread starter lander
  • Start date Start date
It's their job to ensure that a value passed to them is valid. Since no
value is passed, how can it be invalid? It's not their job to ensure that
there is data in a field, that's the job of the RequiredField Validator.
This let's you do things like have an optional email address field that
checks the formatting through a regular expression validator. Since they
don't have to fill it in, you wouldn't want an error reported to them about
incorrect email address. If you don't want it optional, you place a
requiredfield validator there. Then it will always make sure that first,
there's a value there, then second, the value matches the range or regular
expression validator.

Hope this helps,
Mark Fitzpatrick
Microsoft MVP - Expression
 
Back
Top