|
always welcome...
Best Regards,
Apurva Kaushal
|
|
|
|
|
how can i check the string that it has at least "@" sign
for example .......@hotmail.com
i must check that string starting with some text but must end with "@hotmail.com"
|
|
|
|
|
try with
int a = (string).IndexOf("@");
and check the value of a
MHF
|
|
|
|
|
Hi,
By using regular expression you can able to do it.
Just go through the below coading:
<asp:regularexpressionvalidator id="regexpName" runat="server"
="" errormessage="This expression does not validate." controltovalidate="txtName" validationexpression="^([0-9a-zA-Z]([-.\w]*[0-9a-zA-Z])*@([0-9a-zA-Z][-\w]*[0-9a-zA-Z]\.)+[a-zA-Z]{2,9})$">
For more details just visit this site:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnpag2/html/PAGHT000001.asp
Regards
Exelio
|
|
|
|
|
the best way to do email validation is by using java script.
Just cut and paste the following java script. it will work fine.
<html>
<HEAD>
<SCRIPT LANGUAGE="JavaScript">
function emailCheck (emailStr) {
var checkTLD=1;
var
knownDomsPat=/^(com|net|org|edu|int|mil|gov|arpa|biz|aero|name|coop|in
fo|pro|museum)$/;
var emailPat=/^(.+)@(.+)$/;
var specialChars="\\(\\)><@,;:\\\\\\\"\\.\\[\\]";
var validChars="\[^\\s" + specialChars + "\]";
var quotedUser="(\"[^\"]*\")";
var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/;
var atom=validChars + '+';
var word="(" + atom + "|" + quotedUser + ")";
var userPat=new RegExp("^" + word + "(\\." + word + ")*$");
var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$");
var matchArray=emailStr.match(emailPat);
if (matchArray==null) {
alert("Email address seems incorrect (check @ and .'s)");
return false;
}
var user=matchArray[1];
var domain=matchArray[2];
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;
}
}
if (user.match(userPat)==null) {
alert("The username doesn't seem to be valid.");
return false;
}
var IPArray=domain.match(ipDomainPat);
if (IPArray!=null) {
for (var i=1;i<=4;i++) {
if (IPArray[i]>255) {
alert("Destination IP address is invalid!");
return false;
}
}
return true;
}
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;
}
}
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;
}
if (len<2) {
alert("This address is missing a hostname!");
return false;
}
return true;
}
</script>
</HEAD>
<BODY>
<form name=emailform onSubmit="return emailCheck(this.email.value)">
Your Email Address: <input type=text name="email"><br>
<input type=submit value="Submit">
</form>
</body>
</html>
Vipin
|
|
|
|
|
That is probably the most over-bloated way of checking an email address ever...considering javascript supports regular expressions. String mashing to determine email validity is not a solution in todays programming world!
1!
|
|
|
|
|
Hi,
I found some problem in populating the Selected Items in the Shopping Cart.
In my ProductDetail Page, i have the Button for "Add Cart". When i clicked it, that particular item will be added to Cart and that "ShoppingCart" page needs to be displayed with Current Selection and Previously selected items ( if anything is already in cart).
I wish to do it without sending any data in URL. Probably i wish to use JavaScript to do this work..
Can anybody help me in this?
Thanks in advance.
Regars,
Jay
|
|
|
|
|
Hi all
Can any one tell what wrong here
Dim popupScript As String = "" & _
"window.open('PopUp.aspx', 'CustomPopUp', " & _
"'width=200, height=200, menubar=yes, resizable=no')"
Page.RegisterStartupScript("PopupScript", popupScript)
I wrote this code in .aspx page (stand alone page)
But it is giving this error
String constants must end with a double quote
THX
asdfasdfasdfasdfasdfasdfasdfasdfasdfasdf
|
|
|
|
|
I dont find any problem in that. I am not getting any compile time error after the compilation.
Best Regards,
Apurva Kaushal
|
|
|
|
|
It's probably the tag that ends your code in the middle of the string. Split the string in the middle of that tag.
kirthikirthi wrote: THX
here you go[^]
kirthikirthi wrote: asdfasdfasdfasdfasdfasdfasdfasdfasdfasdf
ölkjölkjölkjölkjölkjölkjölkjölkjölkjölkjölkjölkjölkj
---
b { font-weight: normal; }
|
|
|
|
|
Guffa wrote: ölkjölkjölkjölkjölkjölkjölkjölkjölkjölkjölkjölkjölkj
Best Regards,
Apurva Kaushal
|
|
|
|
|
Hi
Dim popupScript As String = "" & _
"window.open('PopUp.aspx', 'CustomPopUp', " & _
"'width=200, height=200, menubar=yes, resizable=no')" & _
""
Page.RegisterStartupScript("PopupScript", popupScript)
Now it is not giving the error
but it is not working (not opening the window)
Thank you
asdfasdfasdfasdfasdfasdfasdfasdfasdfasdf
|
|
|
|
|
Its working fine here. Are you getting any javascript error?
Best Regards,
Apurva Kaushal
|
|
|
|
|
No
I wrote in on buttonclick
But the window is not opening
asdfasdfasdfasdfasdfasdfasdfasdfasdfasdf
|
|
|
|
|
Even there it is working fine. Check whether popup blocked for your browser. And also try it by putting that javascript code in a javascript function and add that as an attribute to the button.
Best Regards,
Apurva Kaushal
|
|
|
|
|
Hi, How do I access an HTML control on my aspx's load event(code behind)? I've added a runat='server' to the control, but that buggers up my access to the control in javascript.
What do I do?
Regards,
Tintin
|
|
|
|
|
You just need to provide the runat and the id attbutes to access the html control in codebehind.
Best Regards,
Apurva Kaushal
|
|
|
|
|
if i add the runat attribute, document.getElementById('imgPic').src doesnt work anymore because the id tag changes to cl00_imgPic. And I cant get it to work with getElementByName.
Regards,
Tintin
|
|
|
|
|
where is the control placed in the webform? Are you using that inside of any other control.
Best Regards,
Apurva Kaushal
|
|
|
|
|
|
I dont fine any problem in accessing that in javascript.
whta i have used is:
var y = document.getElementById("imgPic").src;
and this is html part:
<table>
<tr>
<td>
<img id="imgPic" name="imgPic" src="Image/69.jpg" runat="server"></td>
</tr>
</table>
Best Regards,
Apurva Kaushal
|
|
|
|
|
if u set the html controls in the reapter,datalist etc.. the htmlcontrols or webcontrols will be add some words like "ctl00" before the html id
|
|
|
|
|
sorry. document.getElementbyID im my Javascript (client side)
Regards,
Tintin
|
|
|
|
|
You can access that both in javascript and in code behind after putting ID and runat=server.
Best Regards,
Apurva Kaushal
|
|
|
|
|
tnx, seems to be working now.
Regards,
Tintin
|
|
|
|