469,929 Members | 1,776 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,929 developers. It's quick & easy.

CompareValidator not causing validation

rrocket
116 100+
I keep getting this error:
String was not recognized as a valid DateTime.
when I try to sumbit a form with this
Expand|Select|Wrap|Line Numbers
  1.  <asp:TextBox ID="tbDate" runat="server"></asp:TextBox>
  2.                                     <cc1:CalendarExtender id="bdplPickupDate" runat="server" TargetControlID="tbDate" Format="MM-dd-yyyy" PopupButtonID="tbDate">
  3.                                     </cc1:CalendarExtender>
  4.  
  5.                                     <asp:CompareValidator ID="cvDate"
  6.                                               ControlToValidate="tbDate"
  7.                                               Display="none"
  8.                                               Text="Invalid Date!"
  9.                                               Operator="DataTypeCheck"
  10.                                               Type="Date"
  11.                                               Runat="Server"
  12.                                               ErrorMessage="You must provide a valid date!"
  13.                                               ></asp:CompareValidator>
  14.                                               <cc1:ValidatorCalloutExtender runat="server" ID="vceDate" TargetControlID="cvDate">
  15.                 </cc1:ValidatorCalloutExtender>
  16.  
The cc1 stuff is Ajax, but it still does the same thing whether it is there or not. The compare validator should fire and keep the form from submitting if the date is invalid, but it keeps throwing the error (from above).

Basically I am just trying to check for a valid date.
Feb 22 '08 #1
1 3023
Frinavale
9,735 Expert Mod 8TB
I keep getting this error:
String was not recognized as a valid DateTime.
when I try to sumbit a form with this
Expand|Select|Wrap|Line Numbers
  1.  <asp:TextBox ID="tbDate" runat="server"></asp:TextBox>
  2.                                     <cc1:CalendarExtender id="bdplPickupDate" runat="server" TargetControlID="tbDate" Format="MM-dd-yyyy" PopupButtonID="tbDate">
  3.                                     </cc1:CalendarExtender>
  4.  
  5.                                     <asp:CompareValidator ID="cvDate"
  6.                                               ControlToValidate="tbDate"
  7.                                               Display="none"
  8.                                               Text="Invalid Date!"
  9.                                               Operator="DataTypeCheck"
  10.                                               Type="Date"
  11.                                               Runat="Server"
  12.                                               ErrorMessage="You must provide a valid date!"
  13.                                               ></asp:CompareValidator>
  14.                                               <cc1:ValidatorCalloutExtender runat="server" ID="vceDate" TargetControlID="cvDate">
  15.                 </cc1:ValidatorCalloutExtender>
  16.  
The cc1 stuff is Ajax, but it still does the same thing whether it is there or not. The compare validator should fire and keep the form from submitting if the date is invalid, but it keeps throwing the error (from above).

Basically I am just trying to check for a valid date.
I've actually never used a CompareValidator before...but since you're using the Ajax.NET Toolkit, have you considered using the MaskedEditExtender or the MaskedEditValidator?

-Frinny
Mar 17 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

4 posts views Thread by Axel Dahmen | last post: by
2 posts views Thread by buran | last post: by
1 post views Thread by Jorge EA | last post: by
1 post views Thread by Chris Leffer | last post: by
1 post views Thread by Ron Weldy | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.