Validating using ASP.NET server controls
I have a dateTime variable and I 'm validating it using RegularExpression
@ the client side and that works good.
I 'm also validating if the user is actually inputting something in the
string or leaving it empty, if empty then show error message.
However I was wondering if I could do both functionalities on the client
side, required and then the regular expression, in a single statement?
Current Code (validating only on client side):-
<asp:TextBox ID="TextBox31" runat="server" style="margin-top: 3px"
Width="133px"></asp:TextBox>
<asp:RequiredFieldValidator id="RequiredFieldValidator11" runat="server"
ErrorMessage=" * This is a required field!"
ControlToValidate="TextBox31"></asp:RequiredFieldValidator>
<asp:RegularExpressionValidator id="RegularExpressionValidator8"
runat="server" ControlToValidate="TextBox31" ErrorMessage="* Must be a
valid Date."
ValidationExpression="^(0[1-9]|1[012])[-
/.](0[1-9]|[12][0-9]|3[01])[-
/.](19|20)\d\d$"></asp:RegularExpressionValidator>
Can I combine the error checking statements together in a single statement?
No comments:
Post a Comment