1

在单击“CreateUser”之前,它不会显示最低要求。如何预先验证密码要求并在密码字段失去焦点时显示一条消息。

4

1 回答 1

1

使用如下 CreateUserWizard 控件的默认标记,您不能拥有这样的功能。

<asp:CreateUserWizard ID="CreateUserWizard1" runat="server">
        <WizardSteps>
            <asp:CreateUserWizardStep ID="CreateUserWizardStep1" runat="server">
            </asp:CreateUserWizardStep>
            <asp:CompleteWizardStep ID="CompleteWizardStep1" runat="server">
            </asp:CompleteWizardStep>
        </WizardSteps>
</asp:CreateUserWizard>

因此,我们的想法是CreateUserWizard根据您的需要自定义控件。最好使用验证器,以便您可以事先显示消息。<ContentTemplate>他们的关键是在元素内创建一个<asp:CreateUserWizardStep>元素。

<asp:CreateUserWizardStep ID="CreateUserWizardStep1" runat="server">
<ContentTemplate>
<table>
<tr>
<td>
Sign Up to get started</td>
</tr>
<tr>
<td align="right">
<asp:Label ID="UserNameLabel" runat="server" AssociatedControlID="UserName">
User Name:</asp:Label></td>
<td>
<asp:TextBox ID="UserName" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="UserNameRequired" runat="server" 
     ControlToValidate="UserName" ErrorMessage="User Name is required."
     ToolTip="User Name is required." 
     ValidationGroup="CreateUserWizard1">*</asp:RequiredFieldValidator>
</td>
<tr>
<td>
<asp:Label ID="PasswordLabel" runat="server" AssociatedControlID="Password">
Password:</asp:Label></td>
<td>
<asp:TextBox ID="Password" runat="server" TextMode="Password"></asp:TextBox>
<asp:RequiredFieldValidator ID="PasswordRequired" runat="server" ControlToValidate="Password"
     ErrorMessage="Password is required." ToolTip="Password is required."
     ValidationGroup="CreateUserWizard1">*</asp:RequiredFieldValidator>
</td>
</tr>
</ContentTemplate>
</asp:CreateUserWizardStep>

阅读 MSDN以获得完整的教程。

于 2013-08-16T01:13:18.117 回答