作者在 2008-05-04 17:10:49 发布以下内容
控件名:PasswordStrength
效果即用途:动态的去检测密码的强度,并友好的提示
属性:
TargetControlID:该扩展器目标TextBox控件的ID,即将要添加密码强度指示的TextBox的ID
StrengthIndicatorType:指示密码强度的方式,可选Text和Barindicator,分别代表文本方式和指示条方式
DisplayPosition:强度指示元素与目标TextBox之间的相对位置,可选AboveLeft(左上角)、AboveRight(右上角)、
BelowLeft(左下角)、BelowRight(右下角)、LeftSide(左边)以及RightSide(右边)六种
HelpStatusLabelID:用来帮助用户填写合乎要求的密码而设置的Label的ID。用户在输入密码时,该Label中的文字
将不断更新,以提示用户还应该输入何种类型的字符
TextStrengthDescriptions:用分号(;)链接起来的用来描述不同强度级别的字符串,例如“很弱;弱;中等;强;极强”,
必须满足从弱到强的顺序,且强度级别的数目要在2~10个之间
PrefixText:强度级别的前缀文字
TextCssClass:强度指示文本将应用的CSS Class
BarBorderCssClass:强度指示条的边框将应用的CSS Class
BarIndicatorCssClass:强度指示条将应用的CSS Class
HelpHandlePosition:帮助按钮与目标TextBox之间的相对位置,可选AboveLeft(左上角)、AboveRight(右上角)、
BelowLeft(左下角)、BelowRight(右下角)、LeftSide(左边)以及RightSide(右边)六种
HelpHandleCssClass:帮助按钮将应用的CSS Class
PreferredPasswordLength:强度级别要达到最高所需要的最少密码长度
MinimumNumericCharacters:强度级别要达到最高所需要的最少数字字符的个数
MinimumSymbolCharacters:强度级别要达到最高所需要的最少特殊字符(例如!@#$%等)的个数
RequiresUpperAndLowerCaseCharacters:密码中是否需要混合出现大小写字母才能够使强度级别达到最高
CalculationWeightings:用分号(;)连接起来的4个数值,用来设置计算密码强度时各种类型字符所占的权重,该
属性的默认值为50;15;15;20。由分号隔开的这4个数值的和必须为100,其格式为L;N;C;S,
其中:
L代表Length,即密码的长度在强度计算中的权重
N代表Number,即密码中数字的个数的强度计算中的权重
C代表Case,即密码中混杂的大小写字符的强度计算中的权重
S代表Symbol,即密码中的特殊字符(例如!@#$%)在强度计算中的权重
1.托textox,label,还有PasswordStrength控件到页面,设置PasswordStrength的属性。
2.编写css样式:
<style type="text/css">
.TextIndicator_TextBox1
{}{
background-color:#047AFD;
color:#ffffff;
font-family:Arial;
font-size:9pt;
padding: 2px 3px 2px 3px;
}
.BarIndicator_TextBox2
{}{
color:Blue;
background-color:#047AFD;
padding-bottom:1px;
}
.BarBorder_TextBox2
{}{
border-style:solid;
border-width:1px;
width:200px;
vertical-align:middle;
}
.TextIndicator_TextBox3
{}{
background-color:#047AFD;
color:#ffffff;
font-size:small;
font-variant:small-caps;
padding: 2px 3px 2px 3px;
}
.TextIndicator_TextBox3_Handle
{}{
width:16px;
height:14px;
background-image:url(Question.png);
overflow:hidden;
cursor:help;
}
</style>
3.设置PasswordStrength的属性
<atlasToolkit:PasswordStrength ID="p1" runat="server">
<atlasToolkit:PasswordStrengthExtenderProperties
DisplayPosition="RightSide"
TargetControlID="TextBox1"
StrengthIndicatorType="Text"
PreferredPasswordLength="10"
PrefixText="强度:"
HelpStatusLabelID="TextBox1_HelpLabel"
TextCssClass="TextIndicator_TextBox1"
TextStrengthDescriptions="极弱;弱;中等;强;超强"
MinimumNumericCharacters="0"
MinimumSymbolCharacters="0"
RequiresUpperAndLowerCaseCharacters="false">
</atlasToolkit:PasswordStrengthExtenderProperties>
<atlasToolkit:PasswordStrengthExtenderProperties
DisplayPosition="RightSide"
TargetControlID="TextBox2"
StrengthIndicatorType="BarIndicator"
PreferredPasswordLength="15"
HelpStatusLabelID="TextBox2_HelpLabel"
BarIndicatorCssClass="BarIndicator_TextBox2"
BarBorderCssClass="BarBorder_TextBox2"
MinimumNumericCharacters="1"
MinimumSymbolCharacters="1"
RequiresUpperAndLowerCaseCharacters="true">
</atlasToolkit:PasswordStrengthExtenderProperties>
<atlasToolkit:PasswordStrengthExtenderProperties
DisplayPosition="BelowLeft"
TargetControlID="TextBox3"
StrengthIndicatorType="Text"
PreferredPasswordLength="20"
PrefixText="Meets Policy? "
TextCssClass="TextIndicator_TextBox3"
MinimumNumericCharacters="2"
MinimumSymbolCharacters="2"
RequiresUpperAndLowerCaseCharacters="true"
TextStrengthDescriptions="Not at all;Very Low compliance;Low Compliance;Average Compliance;Good Compliance;Very High Compliance;Yes"
HelpHandleCssClass="TextIndicator_TextBox3_Handle"
HelpHandlePosition="LeftSide">
</atlasToolkit:PasswordStrengthExtenderProperties>
</atlasToolkit:PasswordStrength>
效果即用途:动态的去检测密码的强度,并友好的提示
属性:
TargetControlID:该扩展器目标TextBox控件的ID,即将要添加密码强度指示的TextBox的ID
StrengthIndicatorType:指示密码强度的方式,可选Text和Barindicator,分别代表文本方式和指示条方式
DisplayPosition:强度指示元素与目标TextBox之间的相对位置,可选AboveLeft(左上角)、AboveRight(右上角)、
BelowLeft(左下角)、BelowRight(右下角)、LeftSide(左边)以及RightSide(右边)六种
HelpStatusLabelID:用来帮助用户填写合乎要求的密码而设置的Label的ID。用户在输入密码时,该Label中的文字
将不断更新,以提示用户还应该输入何种类型的字符
TextStrengthDescriptions:用分号(;)链接起来的用来描述不同强度级别的字符串,例如“很弱;弱;中等;强;极强”,
必须满足从弱到强的顺序,且强度级别的数目要在2~10个之间
PrefixText:强度级别的前缀文字
TextCssClass:强度指示文本将应用的CSS Class
BarBorderCssClass:强度指示条的边框将应用的CSS Class
BarIndicatorCssClass:强度指示条将应用的CSS Class
HelpHandlePosition:帮助按钮与目标TextBox之间的相对位置,可选AboveLeft(左上角)、AboveRight(右上角)、
BelowLeft(左下角)、BelowRight(右下角)、LeftSide(左边)以及RightSide(右边)六种
HelpHandleCssClass:帮助按钮将应用的CSS Class
PreferredPasswordLength:强度级别要达到最高所需要的最少密码长度
MinimumNumericCharacters:强度级别要达到最高所需要的最少数字字符的个数
MinimumSymbolCharacters:强度级别要达到最高所需要的最少特殊字符(例如!@#$%等)的个数
RequiresUpperAndLowerCaseCharacters:密码中是否需要混合出现大小写字母才能够使强度级别达到最高
CalculationWeightings:用分号(;)连接起来的4个数值,用来设置计算密码强度时各种类型字符所占的权重,该
属性的默认值为50;15;15;20。由分号隔开的这4个数值的和必须为100,其格式为L;N;C;S,
其中:
L代表Length,即密码的长度在强度计算中的权重
N代表Number,即密码中数字的个数的强度计算中的权重
C代表Case,即密码中混杂的大小写字符的强度计算中的权重
S代表Symbol,即密码中的特殊字符(例如!@#$%)在强度计算中的权重
1.托textox,label,还有PasswordStrength控件到页面,设置PasswordStrength的属性。
2.编写css样式:
<style type="text/css">
.TextIndicator_TextBox1
{}{
background-color:#047AFD;
color:#ffffff;
font-family:Arial;
font-size:9pt;
padding: 2px 3px 2px 3px;
}
.BarIndicator_TextBox2
{}{
color:Blue;
background-color:#047AFD;
padding-bottom:1px;
}
.BarBorder_TextBox2
{}{
border-style:solid;
border-width:1px;
width:200px;
vertical-align:middle;
}
.TextIndicator_TextBox3
{}{
background-color:#047AFD;
color:#ffffff;
font-size:small;
font-variant:small-caps;
padding: 2px 3px 2px 3px;
}
.TextIndicator_TextBox3_Handle
{}{
width:16px;
height:14px;
background-image:url(Question.png);
overflow:hidden;
cursor:help;
}
</style>
3.设置PasswordStrength的属性
<atlasToolkit:PasswordStrength ID="p1" runat="server">
<atlasToolkit:PasswordStrengthExtenderProperties
DisplayPosition="RightSide"
TargetControlID="TextBox1"
StrengthIndicatorType="Text"
PreferredPasswordLength="10"
PrefixText="强度:"
HelpStatusLabelID="TextBox1_HelpLabel"
TextCssClass="TextIndicator_TextBox1"
TextStrengthDescriptions="极弱;弱;中等;强;超强"
MinimumNumericCharacters="0"
MinimumSymbolCharacters="0"
RequiresUpperAndLowerCaseCharacters="false">
</atlasToolkit:PasswordStrengthExtenderProperties>
<atlasToolkit:PasswordStrengthExtenderProperties
DisplayPosition="RightSide"
TargetControlID="TextBox2"
StrengthIndicatorType="BarIndicator"
PreferredPasswordLength="15"
HelpStatusLabelID="TextBox2_HelpLabel"
BarIndicatorCssClass="BarIndicator_TextBox2"
BarBorderCssClass="BarBorder_TextBox2"
MinimumNumericCharacters="1"
MinimumSymbolCharacters="1"
RequiresUpperAndLowerCaseCharacters="true">
</atlasToolkit:PasswordStrengthExtenderProperties>
<atlasToolkit:PasswordStrengthExtenderProperties
DisplayPosition="BelowLeft"
TargetControlID="TextBox3"
StrengthIndicatorType="Text"
PreferredPasswordLength="20"
PrefixText="Meets Policy? "
TextCssClass="TextIndicator_TextBox3"
MinimumNumericCharacters="2"
MinimumSymbolCharacters="2"
RequiresUpperAndLowerCaseCharacters="true"
TextStrengthDescriptions="Not at all;Very Low compliance;Low Compliance;Average Compliance;Good Compliance;Very High Compliance;Yes"
HelpHandleCssClass="TextIndicator_TextBox3_Handle"
HelpHandlePosition="LeftSide">
</atlasToolkit:PasswordStrengthExtenderProperties>
</atlasToolkit:PasswordStrength>
————————————————————