Introduction: in this post I have try to explain how we can use the
PasswordStrength Ajax Control in Asp.net.
Description:
In the last article I
have explained How to install Ajax control Toolkit in Visual Studio, How to useAutoCompleteExtender Ajax control in Asp.net, How to Upload multiple filesusing AjaxFileUpload and save path to database in Asp.net.
Add a webform to project.
After that put the blow given style in between Head Tag:
<style type="text/css" >
.txtpass
{
background-color:none;
font-weight:bold;
}
.Border
{
border:1px solid;
width: 180px;
padding:2px;
}
VeryPoor
{
background: Red;
color:White;
font-weight:bold;
}
.Weak
{
background: Gray;
color:White;
font-weight:bold;
}
.Average
{
background: orange;
color:black;
font-weight:bold;
}
.Good
{
background: blue;
color:White;
font-weight:bold;
}
.Excellent
{
background: Green;
color:White;
font-weight:bold;
}
.lbltext
{
font-weight:bold;
}
Drag and drop the
Textbox and PasswordStrength control from Toolbox.
We can show the Password
Strength in two types and use property StrengthIndicatorType:
1.
Text
2.
Bar
HelpStatusLabelID: To show help for password like Numeric, Lower
etc.
TargetControlID: Textbox to show password strength.
PreferredPasswordLength: Password lenghth.
TextStrengthDescriptionStyles: To show Password Strength Style.
<asp:scriptmanager ID="Scriptmanager1"
runat="server"></asp:scriptmanager>
<table>
<tr><b>PasswordStrength
Ajax Control Example</b></tr>
<tr><td>Password
Strength (Text):</td><td><asp:TextBox ID="txtpass"
runat="server"
TextMode="Password"></asp:TextBox></td></tr>
<tr><td></td><td><asp:Label ID="lbl" runat="server" CssClass="lbltext"></asp:Label></td></tr>
<tr><td>Password
Strength (Bar Indicator):</td><td><asp:TextBox ID="txtpass1" runat="server" TextMode="Password"></asp:TextBox></td></tr>
<tr><td> </td><td><asp:Label ID="lbl1" runat="server" CssClass="lbltext"></asp:Label></td></tr>
</table>
<asp:PasswordStrength ID="PasswordStrength1" runat="server"
TargetControlID="txtpass"
HelpStatusLabelID="lbl"
TextCssClass="txtpass"
PreferredPasswordLength="8"
StrengthIndicatorType="Text"
MinimumLowerCaseCharacters="1" MinimumNumericCharacters="1" MinimumSymbolCharacters="1">
</asp:PasswordStrength>
<asp:PasswordStrength ID="PasswordStrength2" runat="server"
TargetControlID="txtpass1"
HelpStatusLabelID="lbl1"
PrefixText="Strength"
PreferredPasswordLength="8"
StrengthIndicatorType="BarIndicator"
MinimumLowerCaseCharacters="1" MinimumNumericCharacters="1"
TextStrengthDescriptionStyles="VeryPoor;Weak;Average;Good;Excellent" MinimumSymbolCharacters="1"
BarBorderCssClass="Border">
</asp:PasswordStrength>
Run the project and check the result.
No comments:
Post a Comment