473,387 Members | 1,592 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Required Field Validator

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
Nov 24 '06 #1
7 6099
That's what the regular expression validator is for. You can use that in
conjunction with a required field validator.

--
Hope this helps,
Mark Fitzpatrick
Former Microsoft FrontPage MVP 199?-2006
"Newbie Coder" <ne**********@pleasespamme.comwrote in message
news:eZ**************@TK2MSFTNGP06.phx.gbl...
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


Nov 24 '06 #2
The previous control didn't have a validation expression property either.
You are thinking of a regular expression validator.
"Newbie Coder" <ne**********@pleasespamme.comwrote in message
news:eZ**************@TK2MSFTNGP06.phx.gbl...
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


Nov 24 '06 #3
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?
"Newbie Coder" <ne**********@pleasespamme.comwrote in message
news:eZ**************@TK2MSFTNGP06.phx.gbl...
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


Nov 24 '06 #4
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.
"Newbie Coder" <ne**********@pleasespamme.comwrote in message
news:e$**************@TK2MSFTNGP03.phx.gbl...
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?
"Newbie Coder" <ne**********@pleasespamme.comwrote in message
news:eZ**************@TK2MSFTNGP06.phx.gbl...
>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



Nov 24 '06 #5
Thank you

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

Thanks again

"Scott M." <s-***@nospam.nospamwrote in message
news:eP**************@TK2MSFTNGP04.phx.gbl...
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.
"Newbie Coder" <ne**********@pleasespamme.comwrote in message
news:e$**************@TK2MSFTNGP03.phx.gbl...
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?
"Newbie Coder" <ne**********@pleasespamme.comwrote in message
news:eZ**************@TK2MSFTNGP06.phx.gbl...
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



Nov 24 '06 #6
No problem. How's that hit counter coming along?
"Newbie Coder" <ne**********@pleasespamme.comwrote in message
news:O8**************@TK2MSFTNGP02.phx.gbl...
Thank you

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

Thanks again

"Scott M." <s-***@nospam.nospamwrote in message
news:eP**************@TK2MSFTNGP04.phx.gbl...
>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.
"Newbie Coder" <ne**********@pleasespamme.comwrote in message
news:e$**************@TK2MSFTNGP03.phx.gbl...
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?
"Newbie Coder" <ne**********@pleasespamme.comwrote in message
news:eZ**************@TK2MSFTNGP06.phx.gbl...
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




Nov 24 '06 #7
Hit counter. What hit counter?

"Scott M." <s-***@nospam.nospamwrote in message
news:ex**************@TK2MSFTNGP02.phx.gbl...
No problem. How's that hit counter coming along?
"Newbie Coder" <ne**********@pleasespamme.comwrote in message
news:O8**************@TK2MSFTNGP02.phx.gbl...
Thank you

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

Thanks again

"Scott M." <s-***@nospam.nospamwrote in message
news:eP**************@TK2MSFTNGP04.phx.gbl...
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.
"Newbie Coder" <ne**********@pleasespamme.comwrote in message
news:e$**************@TK2MSFTNGP03.phx.gbl...
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?
"Newbie Coder" <ne**********@pleasespamme.comwrote in message
news:eZ**************@TK2MSFTNGP06.phx.gbl...
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





Nov 24 '06 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Martin | last post by:
Dear Group It says in MSDN that a field can be associated with more than one validators but can one validator be associated with more than one field? Or do I need a validator for each field? How...
2
by: z. f. | last post by:
Hi, i have a field with required field validator. on the client side it's working. when i submit without the required field the page gets back because of not valid, but the message from the...
1
by: Brian Shannon | last post by:
I built a composit control consisting of a calandar control and a text box and an image of a calandar. Depending on what page I place this control the Date field needs to be required. If the...
1
by: Sam Collett | last post by:
Is there a way of having a required field validator check to see if at least one of a set of controls has information in it? I'm sure this can somehow be done using a custom validator, but would...
2
by: pmud | last post by:
Hi, I have an ASP.Net web page . The page was working fine until I added a required field field validator. My page has a link button which takes the user to another page, a submit button which...
3
by: Skeptical | last post by:
Hello, I have a form and two buttons on it. Button1 submits the data to a database and RequiredFieldValidator is used to make sure all the required fields are filled up, the second button has a...
2
by: David Hearn | last post by:
I have some required field validators on a form and would like to know if there is a way to set focus back to the field that is required if the validator is triggered. The problem is that the...
3
by: Kivak Wolf | last post by:
Hi, Could someone give me a quick review of how to use the required field Validator? I'm completely at a loss, and MSDN does not help one bit. =/ Basically all I want done is to make sure that...
3
by: Mike Collins | last post by:
Is it possible to use a required field validator and have it make a user answer a comment field based on a drop down value picked? For instance, if the user selects "It was terrible", make them...
0
by: nimeshdotnet | last post by:
Hi All, I have a textbox whose readonly property is set to true. This textbox is also guarded by a required field validator. What i m doing that I have a calendar control whose on date selection i...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.