Validation Control question

  • Thread starter Thread starter fiefie.niles
  • Start date Start date
F

fiefie.niles

For a Password field I would like a Validation Control to make sure
the password contains alphanumeric and number and has 8 characters.
What Validation Control can I use for this purpose ?
Thank you.
 
Thank you for your help.
I tried the regular expression ^.{4,8}$ but even when I type in "asdf",
"1234", or "asdf1234" when I click on the submit button it keeps giving me
the error "Password must be between 4 and 8 characters in length". What did
I do wrong in the following Page1.aspx ? Thank you.
<body>
<form id="form1" runat="server">
<div>
<input id="txtPassword" runat=server type="password" />&nbsp;
<asp:RegularExpressionValidator ID="RegularExpressionValidator1"
runat="server" ControlToValidate="txtPassword"
ErrorMessage="Password must be between 4 and 8 characters in length"
ValidationExpression="^.{4,8}$"></asp:RegularExpressionValidator>
<br />
<asp:Button ID="txtSubmit" runat="server" Text="Submit" /></div>
</form>
</body>
 
Back
Top