I’m having an issue with a standard ASP.NET portal.
Suppose that has a TextBox and a RequiredFieldValidator. I want the validator only shows the error message when I input a wrong format text.

However the current issue is even I haven’t input nothing, it displays the message. After I type the correct text, it disappeared then.
My code:
<tr>
<td>
*First Name:
</td>
<td>
<asp:TextBox runat="server" ID="FirstName" MaxLength="50" />
<asp:RequiredFieldValidator runat="server" ID="RequiredFieldValidator1" ControlToValidate="FirstName"
ErrorMessage="First Name is required." EnableClientScript="True" />
</td>
</tr>
<tr>
The code behind is something like
protected void Page_Load(object sender, EventArgs e)
{
Page.Validate();
if (!Page.IsPostBack)
{
// blah
}
}
Thanks.
That’s what the RequiredFieldValidator is supposed to do. Use another type of validator such as a RegularExpressionValidator or a CustomValidator.
Also how do you define the correct format for a person’s name?