473,386 Members | 1,842 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,386 software developers and data experts.

q: emial validation

Hello,
I need to validate e-mail, so I need to see if textbox matches
*@myDomain.com, how can I do this?
Thanks,
Jim.

Nov 19 '05 #1
2 1129
You need to tie a regular expressionv alidator to a requried field validator
in your form. The validation expression below is a bit simple so you might
choose to find a better regexp, but the code should function to get you
running. I've not tried this code mind you....
<asp:textbox id="textbox1" runat="server"/>
<asp:RegularExpressionValidator id="valRegEx" runat="server"
ControlToValidate="textbox1"
ValidationExpression=".*@.*\..*"
ErrorMessage="* Your entry is not a valid e-mail address."
display="dynamic">*</asp:RegularExpressionValidator>You might also want
to try this as the validation
expression.ValidationExpression=".*@myDomain.com"
-- Regards
John Timney
ASP.NET MVP
Microsoft Regional Director

"JIM.H." <JI**@discussions.microsoft.com> wrote in message
news:AE**********************************@microsof t.com...
Hello,
I need to validate e-mail, so I need to see if textbox matches
*@myDomain.com, how can I do this?
Thanks,
Jim.

Nov 19 '05 #2
There are some other good regex patterns that check for legal email-address
patterns. You could easily modify them to fix the domain to a specific
string, if you like.

http://www.regexlib.com/DisplayPatterns.aspx
"John Timney (ASP.NET MVP)" <ti*****@despammed.com> wrote in message
news:eF**************@TK2MSFTNGP12.phx.gbl...
You need to tie a regular expressionv alidator to a requried field validator in your form. The validation expression below is a bit simple so you might choose to find a better regexp, but the code should function to get you
running. I've not tried this code mind you....
<asp:textbox id="textbox1" runat="server"/>
<asp:RegularExpressionValidator id="valRegEx" runat="server"
ControlToValidate="textbox1"
ValidationExpression=".*@.*\..*"
ErrorMessage="* Your entry is not a valid e-mail address."
display="dynamic">*</asp:RegularExpressionValidator>You might also want to try this as the validation
expression.ValidationExpression=".*@myDomain.com"
-- Regards
John Timney
ASP.NET MVP
Microsoft Regional Director

"JIM.H." <JI**@discussions.microsoft.com> wrote in message
news:AE**********************************@microsof t.com...
Hello,
I need to validate e-mail, so I need to see if textbox matches
*@myDomain.com, how can I do this?
Thanks,
Jim.


Nov 19 '05 #3

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

Similar topics

21
by: Stefan Richter | last post by:
Hi, after coding for days on stupid form validations - Like: strings (min / max length), numbers(min / max value), money(min / max value), postcodes(min / max value), telefon numbers, email...
2
by: wumingshi | last post by:
Hi, When validating an XML instance, sometimes the schema is not enough to expression the validation rules. Additional validation rules may be expressed in an application-specific way. For...
4
by: Tim Meagher | last post by:
I am trying to use both validation controls and to add submit button attributes, but when I add the button attributes, the javascript fpr the validation controls is no longer created for the page. ...
7
by: Tim Meagher | last post by:
I am trying to use both validation controls and to add submit button attributes, but when I add the button attributes, the javascript fpr the validation controls is no longer created for the page. ...
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.