Ajax控件之PasswordStrength
效果:以密码的长度来判断密码的强弱程度
1. 拖入TextBox,Label,PasswordStrength并进行绑定
2. 修改TextBox/ PasswordStrenth/HelpStatusLabelID:Label1,PrefixText:密码强度,TextStrengthDescript: 弱;一般;中;强
3.添加样式:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title>Ajax控件之PasswordStrength</title> <style type="text/css"> .StyleTextBox1 { background-color:lemonchiffon; color:red; font-familey:Arial; font-size:x-small; padding:2px 3px 2px 3px } </style> </head> <body style="text-align: center"> <form id="form1" runat="server"> <asp:ScriptManager ID="ScriptManager1" runat="server" /> <div> <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox> <br /> <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label> <cc1:PasswordStrength ID="PasswordStrength1" runat="server" HelpStatusLabelID="Label1" PrefixText="密码强度" TargetControlID="TextBox1" TextCssClass="StyleTextBox" TextStrengthDescriptions="弱;一般;中;强"> </cc1:PasswordStrength> </div> </form> </body> </html>
|