Validate at least one numeric,one alphabet without using special character password using RegularExpressionValidator in asp.net C#
Source Code:-
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:TextBox ID="txtpwd" runat="server" Width="180px"></asp:TextBox>
<asp:RegularExpressionValidator ID="revpwd" runat="server" ErrorMessage="Choose at
least 6 character,one numeric,one alphabet without special charachter
"
ValidationExpression="(?!^[0-9]*$)(?!^[a-zA-Z]*$)^([a-zA-Z0-9]{6,10})$"
ControlToValidate="txtpwd" ForeColor="Red" Style="font-size: small"
Display="Dynamic"></asp:RegularExpressionValidator>
</div>
</form>
</body>
</html>
Out-Put :-
Validate at least one numeric,one alphabet without using special character password using RegularExpressionValidator in asp.net C#
Reviewed by NEERAJ SRIVASTAVA
on
10:53:00 PM
Rating:
No comments: