简体   繁体   English

ASP.NET CreateUserWizard错误消息

[英]ASP.NET CreateUserWizard Error Messages

I am using the ASP.NET CreateUserWizard as a signup form to my website. 我使用ASP.NET CreateUserWizard作为我网站的注册表单。 I have it working fine but I wanted to add validation to my fields. 我的工作正常,但我想向我的字段添加验证。 I setup asp:RequiredFIeldValidators and also asp:CustomValidators. 我设置了asp:RequiredFIeldValidators和as:CustomValidators。 The goal of my validators is to check each field individually and then if the text does not pass then the page will be marked as invalid and an error message will display under each invalid textbox. 我的验证器的目的是单独检查每个字段,然后如果文本没有通过,则该页面将被标记为无效,并且在每个无效的文本框下方都会显示一条错误消息。 When I run my website and I put information to flag the validators in my website stops the page from progressing further which is correct. 当我运行我的网站时,我在网站上放置了一些信息来标记验证器,这将阻止页面继续进行,这是正确的。 The problem is that my validators do not display the error message. 问题是我的验证程序没有显示错误消息。 Here is a short version of my form (I cut out all but one field so it is easier to read): 这是我的表格的简短版本(我只剪掉一个字段,所以很容易阅读):

<asp:CreateUserWizard ID="CreateUser" runat="server" LoginCreatedUser="false" RequireEmail="true" DisableCreatedUser="true">
<WizardSteps>
    <asp:CreateUserWizardStep runat="server">
        <ContentTemplate>
                <tr>
                    <td>
                        <asp:Label ID="FirstNameLabel" runat="server" AssociatedControlID="FirstName">First Name: </asp:Label>
                    </td>
                    <td>
                        <asp:TextBox ID="FirstName" runat="server" /><asp:Label ID="lblFirstName" runat="server" />
                        <asp:RequiredFieldValidator ID="FirstNameRequired" runat="server" ControlToValidate="FirstName" ErrorMessage="Your first name is required." ToolTip="Your first name is required." ValidationGroup="CreateUserVal">*</asp:RequiredFieldValidator>
                        <asp:Literal runat="server" EnableViewState="false" ID="LiteralFirstNameError"></asp:Literal>
                        <asp:CustomValidator ValidationGroup="val1" runat="server" ID="ValidaterFirstNameCheck" ControlToValidate="FirstName" OnServerValidate="ValidateFirstName" ErrorMessage="Error!" />
                    </td>
                </tr>

A email has been sent to your mailbox. 电子邮件已发送到您的邮箱。 Please follow the instructions in the email to activate your account. 请按照电子邮件中的说明激活您的帐户。

Any help is appreciated. 任何帮助表示赞赏。 Thanks in advance. 提前致谢。

要显示错误消息,您必须删除RequiredFieldValidator中的*。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM