Hi, I'm having trouble understanding how to use validators and how to check if the page is valid. I have a RequiredFieldValidator that is working fine, but I would like to add some friendly text before the validator error message and am having trouble with
that. So far I have:
Protected Sub SubmitButton_Click(sender As Object, e As EventArgs)
If Page.IsValid Then
ErrorText.Text = "Thanks for your submission"
Else
ErrorText.Text = "There was a problem with your submission:"
End If
End Sub
And then I have
<asp:Literal ID="ErrorText" runat="server"></asp:Literal>
<form... etc.
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" ControlToValidate="first" Backcolor="Yellow" Text="Please enter your first name<br>" Display="Dynamic" runat="server"></asp:RequiredFieldValidator>
& ...
Go to the complete details ...