473,403 Members | 2,366 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,403 software developers and data experts.

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 3140
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

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

Similar topics

4
by: Axel Dahmen | last post by:
Hi, I've got the same problem as described below. No answer found yet. Can someone please help? (I'm using .NET 1.0 on my development machine and 1.1 on my webserver. Like Susanna, I only get...
2
by: buran | last post by:
Dear ASP.NET Programmers, I am using a CompareValidator control to check the values entered into a texbox. The textbox is for currencies, so the property Operator is set to DataTypeCheck and the...
1
by: Neo | last post by:
I use CompareValidator to validate a date. But CompareValidator can only one date format at one time. if the dateorder is "mdy", date format can only be mdy even if date format is ymd. But users...
1
by: Jorge EA | last post by:
Hi there, According to the following article, a textbox for a date entry field can be validated with a CompareValidator: ...
2
by: Eric Maia | last post by:
I have a textbox (StartDateTextBox) in a UserControl on my page, that is supposed to have a date entered into it. I have a RequiredFieldValidator that has its ControlToValidate property set to the...
1
by: Chris Leffer | last post by:
Hi. I set a CompareValidator using DataTypeCheck = Integer to validate a textbox. When I type 199b on the textbox, the validator control accepts the value. If I set the same validator control...
1
by: Ron Weldy | last post by:
I want to have a optional field on a form that can be blank but if the user enters something, it must be a number. I'm using a CompareValidator with the datatype check but if I submit the form with...
3
by: CyberLotus | last post by:
Hi, I wish to validate the date a user has entered against the format dd-mmm-yyyy using the CompareValidator, but it does not work. Does anybody have a simple solution please? Many thanks...
1
by: dnnddane | last post by:
Hi, I guess you all already know about the comparevalidator when the value of input control(ControlToValidate) is empty/null, it causes the validation success. I know we can use...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.