You can use RegularExpressionValidatorit if you use validators for other things, you can also stay with this:
<asp:RegularExpressionValidator ID="valMinLength" runat="server"
ControlToValidate="myPasswordBox"
ErrorMessage="Password should have at least 6 characters"
ValidationExpression="/{6,}/" />
source
share