Document directory
- Introduction
- Important attributes
- Example
Introduction
The passwordstrength control is used to prompt the user to enter the password. When the user enters the password in the password box, a prompt is displayed at the end of the text box, showing the password strength. There are two ways to prompt this prompt: you can set the text and progress bar, and set the position of the prompt information. The style can be defined by CSS. When the Password box loses focus, the prompt will automatically disappear. Next let's take a look at the important attributes of the control.
Important attributes
Targetcontrolid: ID of the password box
Displayposition: the position where the message is displayed. There are 6 values: rightside aboveright aboveleft leftside belowright belowleft
Strengthindicatortype: Set the display mode, text, or progress bar.
Text: text display
Barindicator: displayed as a progress bar
Preferredpasswordlength: the most suitable password length
Textcssclass: the style of the prompt message
Minimumnumericcharacters: Number of at least numbers in the password
Minimumsymbolcharacters: the password must contain at least the number of special characters
Barbordercssclass: Specifies the border style of the progress bar.
Barindicatorcssclass: Specifies the style of the progress bar.
Example
1. Open vs2005 and create an ajaxcontroltoolkit website named oec2003_passwordstrength.
2. Open the default. aspx page and switch to the design view.
3. Add a text box control and a passwordstrength control to the page and set the attributes of the passwordstrength space as follows:
<ajaxtoolkit:passwordstrength id="PasswordStrength1" runat="server" targetcontrolid="TextBox1" strengthindicatortype="BarIndicator" preferredpasswordlength="12" mini mumnumericcharacters="3" minimumsymbolcharacters="1" barindicatorcssclass="bartype" barbordercssclass="barborder"> </ajaxtoolkit:passwordstrength>
4. Add the CSS style to the head tag as follows:
<style type="text/css"> .bartype { color:blue; background-color:green; } .barborder { border-style:solid; border-width:1px; width:200px; vertical-align:middle; } </style>
5. Save the design and press F5 to run it.
Although this control is very convenient, it still does not feel very flexible. Maybe I have not thoroughly studied this control, so I will continue to study it later.
This control also has the prefixtexts attribute (prefix used to display the prompt information) and textstrengthdescriptions (content of the prompt message for password strength, such as weak or strong) attributes, however, these two controls are valid only when the strengthindicatortype attribute is set to text. When the strengthindicatortype attribute is set to text, the prefix and strength prompt messages are not displayed, I don't know if the control is originally set incorrectly ...........