Required Field Validator

N

Newbie Coder

How do I use a Required Field Validator control in ASP.NET 2.0 to validate
an e-mail address entered into a textbox control because there is no
VALIDATION EXPRESSION like in previous versions?

TIA

Newbie Coder
 
M

Mark Fitzpatrick

That's what the regular expression validator is for. You can use that in
conjunction with a required field validator.
 
S

Scott M.

The previous control didn't have a validation expression property either.
You are thinking of a regular expression validator.
 
N

Newbie Coder

Thank you

But if I add the control you mentioned & type nothing in the textbox
(txtEmail) then the validator doesn't show. If I type for example 'a' in
there then it does show. How can I get it to validate an empty textbox
control too?
 
S

Scott M.

You need to use 2 validators that both point to the textbox as the
ControlToValidate. You need to add a RequiredFieldValidator and a
RegularExpressionValidator with the ValidationExpression property set to
Internet Email Address.
 
N

Newbie Coder

Thank you

I was thinking the same, but wasn't sure. You have cleared that point up for
me

Thanks again
 

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,982
Messages
2,570,185
Members
46,738
Latest member
JinaMacvit

Latest Threads

Top