|
musefan wrote: well one option would be to check for a '@' character in the textbox.Text string, then see if there is atleast one '.' character after the '@' character.
Have you ever heard of Regular Expressions?
In fact, Regular Expression validators(as the name suggest) can do this with lot ease.
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
I have, but I dont remember how to do off top of head so offered another solution
|
|
|
|
|
<asp:TextBox ID="tbEmail" runat="server" ValidationGroup="Register" />
<asp:RegularExpressionValidator ForeColor="Red" ValidationGroup="Register" ControlToValidate="tbEmail" ErrorMessage="Email Address is not valid." ValidationExpression="^([0-9a-zA-Z]([-.\w]*[0-9a-zA-Z])*@([0-9a-zA-Z][-\w]*[0-9a-zA-Z]\.)+[a-zA-Z]{2,9})$" EnableClientScript="true" ID="RegularExpressionValidator1" runat="server" Display="Dynamic" />
Or you could create a custom validator that will do the validation for you and set your page IsValid property to true or false depending whether valid or not.
|
|
|
|
|
abu rakan wrote: hi men
There are women on this site, too.
There's a control built in for validating text, or, as someone said, you can use regex.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
I am soooooo sorry "Christian Graus" about hi men
about my problem actually i don't understand you or
may be you don't understand me!!!!
|
|
|
|
|
This is a javascript email validator. This validator can be customized to allow any domain name.
// Email Validator
function emailCheck (emailStr) {
/* The following variable tells the rest of the function whether or not
to verify that the address ends in a two-letter country or well-known
TLD. 1 means check it, 0 means don't. */
var checkTLD=1;
/* The following is the list of known TLDs that an e-mail address must end with. */
var knownDomsPat=/^(com|net|org|edu|int|mil|gov|arpa|biz|aero|name|coop|info|pro|museum)$/;
/* The following pattern is used to check if the entered e-mail address
fits the user@domain format. It also is used to separate the username
from the domain. */
var emailPat=/^(.+)@(.+)$/;
/* The following string represents the pattern for matching all special
characters. We don't want to allow special characters in the address.
These characters include ( ) < > @ , ; : \ " . [ ] */
var specialChars="\\(\\)><@,;:\\\\\\\"\\.\\[\\]";
/* The following string represents the range of characters allowed in a
username or domainname. It really states which chars aren't allowed.*/
var validChars="\[^\\s" + specialChars + "\]";
/* The following pattern applies if the "user" is a quoted string (in
which case, there are no rules about which characters are allowed
and which aren't; anything goes). E.g. "jiminy cricket"@disney.com
is a legal e-mail address. */
var quotedUser="(\"[^\"]*\")";
/* The following pattern applies for domains that are IP addresses,
rather than symbolic names. E.g. joe@[123.124.233.4] is a legal
e-mail address. NOTE: The square brackets are required. */
var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/;
/* The following string represents an atom (basically a series of non-special characters.) */
var atom=validChars + '+';
/* The following string represents one word in the typical username.
For example, in john.doe@somewhere.com, john and doe are words.
Basically, a word is either an atom or quoted string. */
var word="(" + atom + "|" + quotedUser + ")";
// The following pattern describes the structure of the user
var userPat=new RegExp("^" + word + "(\\." + word + ")*$");
/* The following pattern describes the structure of a normal symbolic
domain, as opposed to ipDomainPat, shown above. */
var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$");
/* Finally, let's start trying to figure out if the supplied address is valid. */
/* Begin with the coarse pattern to simply break up user@domain into
different pieces that are easy to analyze. */
var matchArray=emailStr.match(emailPat);
if (matchArray==null) {
/* Too many/few @'s or something; basically, this address doesn't
even fit the general mould of a valid e-mail address. */
//alert("Email address seems incorrect (check @ and .'s)");
return false;
}
var user=matchArray[1];
var domain=matchArray[2];
// Start by checking that only basic ASCII characters are in the strings (0-127).
for (i=0; i<user.length; i++) {
if (user.charCodeAt(i)>127) {
//alert("Ths username contains invalid characters.");
return false;
}
}
for (i=0; i<domain.length; i++) {
if (domain.charCodeAt(i)>127) {
//alert("Ths domain name contains invalid characters.");
return false;
}
}
// See if "user" is valid
if (user.match(userPat)==null) {
// user is not valid
//alert("The username doesn't seem to be valid.");
return false;
}
/* if the e-mail address is at an IP address (as opposed to a symbolic
host name) make sure the IP address is valid. */
var IPArray=domain.match(ipDomainPat);
if (IPArray!=null) {
// this is an IP address
for (var i=1;i<=4;i++) {
if (IPArray[i]>255) {
//alert("Destination IP address is invalid!");
return false;
}
}
return true;
}
// Domain is symbolic name. Check if it's valid.
var atomPat=new RegExp("^" + atom + "$");
var domArr=domain.split(".");
var len=domArr.length;
for (i=0;i<len;i++) {
if (domArr[i].search(atomPat)==-1) {
//alert("The domain name does not seem to be valid.");
return false;
}
}
/* domain name seems valid, but now make sure that it ends in a
known top-level domain (like com, edu, gov) or a two-letter word,
representing country (uk, nl), and that there's a hostname preceding
the domain or country. */
if (checkTLD && domArr[domArr.length-1].length!=2 &&
domArr[domArr.length-1].search(knownDomsPat)==-1) {
//alert("The address must end in a well-known domain or two letter " + "country.");
return false;
}
// Make sure there's a host name preceding the domain.
if (len<2) {
//alert("This address is missing a hostname!");
return false;
}
// If we've gotten this far, everything's valid!
return true;
}
|
|
|
|
|
I want to define a color array based on the system defined color such as Color.Blue, Color.Green and so on.
that is: Color [50] color_array=new Color [50]
but I don't know how to define it in an easy way so that I don't need to write all the available color by hand, because if I want to write all, it will take so long time, is there any simple way? thanks.
|
|
|
|
|
you can iterate over the Colors array that exists already, or use loops to build colors with steadily increasing r/g/b values.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
The color's that are availableare actually static properties of the Color class, so I think you may have to use reflection.
There's not *that* many, it'd be easier to do it by hand and your program will run much quicker IMO.
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)
|
|
|
|
|
He could always write a microapp that used reflection to write out a hardcoded list to include in his main program.
Today's lesson is brought to you by the word "niggardly". Remember kids, don't attribute to racism what can be explained by Scandinavian language roots.
-- Robert Royall
|
|
|
|
|
you can use the KnownColor[^] enumeration to do stuff like this:
foreach (string color in Enum.GetNames(typeof(KnownColor)))
{
}
|
|
|
|
|
Pls send me the article on latest version of HL7
|
|
|
|
|
hi
Vuyiswa Maseko,
Few companies that installed computers to reduce the employment of clerks have realized their expectations.... They now need more and more expensive clerks even though they call them "Developers" or "Programmers."
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.tiyaneProperties.co.za
vuyiswam@its.co.za
|
|
|
|
|
Thank u
|
|
|
|
|
Just wanted to say "Hi".
See - it doesn't quite work does it?
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)
|
|
|
|
|
This is not the HL7 support site.
Beyond that, if you're working with HL7, it sucks to be you. Of course, you could be working on AHLTA, and that sucks even more.
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
Seems like this forum is even worse, today...
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
google broken where you live ? Or are you just stupid ?
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
Christian Graus wrote: Or are you just stupid ?
You made me remember the dialog from the movie 'The Game Plan'
Stupid is a very mean word... , but what a bout stupidest
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
I do recommend you read the guide on how to ask questions here.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
No, for some reason, everyone thinks CP is the new "LetMeGoogleThatForYou" site.
|
|
|
|
|
Hi, you forgot 'urgentz '.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
i need to save screen as video file.
how can i do it?
please give advice to me.
thanks so much...
|
|
|
|
|
google.
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
Wow! Are they doing screen capture software now?
Panic, Chaos, Destruction.
My work here is done.
|
|
|
|