0

我对更改密码控件进行了以下设置:

<asp:ChangePassword ID="ChangePassword1" runat="server">
        <ChangePasswordTemplate>
            <h3>
                Password Management</h3>
            <asp:TextBox ID="CurrentPassword" runat="server" TextMode="Password" Style="display: none;"></asp:TextBox>
            <div class="field">
                <asp:Label ID="NewPasswordLabel" runat="server" AssociatedControlID="NewPassword">New Password:</asp:Label>
                <asp:TextBox ID="NewPassword" runat="server" TextMode="Password"></asp:TextBox>
                <asp:RequiredFieldValidator ID="NewPasswordRequired" runat="server" ControlToValidate="NewPassword" Display="Dynamic"
                    ErrorMessage="New Password" ToolTip="New Password is required."
                    ValidationGroup="ChangePassword1" EnableClientScript="false"></asp:RequiredFieldValidator>
            </div>
            <div class="field">
                <asp:Label ID="ConfirmNewPasswordLabel" runat="server" AssociatedControlID="ConfirmNewPassword">Confirm New Password:</asp:Label>
                <asp:TextBox ID="ConfirmNewPassword" runat="server" TextMode="Password"></asp:TextBox>

                <asp:RequiredFieldValidator ID="ConfirmNewPasswordRequired" runat="server" ControlToValidate="ConfirmNewPassword"
                    ErrorMessage="Confirm New Password" ToolTip="Confirm New Password is required." Display="Dynamic"
                    ValidationGroup="ChangePassword1" EnableClientScript="false"></asp:RequiredFieldValidator>
            </div>
            <div class="field">
                <asp:CompareValidator ID="NewPasswordCompare" runat="server" ControlToCompare="NewPassword"
                    ControlToValidate="ConfirmNewPassword" Display="Dynamic" ErrorMessage="The Confirm New Password must match the New Password entry."
                    ValidationGroup="ChangePassword1"></asp:CompareValidator>
            </div>

            <asp:ValidationSummary ID="ChangeUserPasswordValidationSummary" runat="server" CssClass="failureNotification" 
             ValidationGroup="ChangePassword1"/>


            <div class="action">
            <asp:Button ID="ChangePasswordPushButton" runat="server" CommandName="ChangePassword"
                Text="Change Password" ValidationGroup="ChangePassword1" />
            <asp:Button ID="CancelPushButton" runat="server" CausesValidation="False" CommandName="Cancel"
                Text="Cancel" Width="120" />
                </div>
        </ChangePasswordTemplate>
    </asp:ChangePassword>

当我单击 ChangePasswordPushButton 时,除了验证摘要显示 2 个星号之外,验证所有工作都按预期工作!

任何人都知道为什么

4

2 回答 2

0

我发现了问题所在。在主题中设置了错误消息!

呸呸呸

于 2013-06-13T12:35:10.880 回答
0

尝试在所有验证器和 ValidationSummary 上添加以下代码:

EnableTheming="False"
于 2015-12-04T15:08:42.957 回答