RegularExpressionValidator - check for empty field

O

Oleg Ogurok

Hi all,

I want to use RegularExpressionValidator to enforce non-empty integer format
in a TextBox. However, the validator doesn't give the error when the textbox
is empty. For example, if ValidationExpression is \d+ or even \d{1,}, the
validator still allows empty field. Must I use an additional
RequiredFieldValidator?

-Oleg.
 
W

William F. Robertson, Jr.

If a field is empty every validator (except RequiredFieldValidator) will not
be called.

If a field is required AND has an expected format, you will have to include
2 validators.

Or you can look at writing your own composite control that has both
validators inside it.

bill
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,535
Members
45,007
Latest member
obedient dusk

Latest Threads

Top