473,394 Members | 1,721 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,394 software developers and data experts.

Compare Validator Control error

Can someone help me. I'm trying to use the following validator control and
compare a date to a date defined in the code-behind page. My code is below
along with my error message I get when the page is rendering in the browser.
Has anyone any idea what I've done wrong?

<asp:CompareValidator ID=cvDate Font-Size=small ForeColor=red Runat=server
ErrorMessage="Please work" Operator=LessThanEqual Type=Date
ControlToValidate=txtStartDate
ValueToCompare="<%#CompareDate()%>">*</asp:CompareValidator>

/// <summary>
/// Return a date for comparison
/// </summary>
/// <returns>a date string</returns>
public string CompareDate()
{
return DateTime.Today.ToShortDateString();
}

Browser Error Message
The value '' of the ValueToCompare property of 'cvDate' cannot be converted
to type 'Date'.
Jul 21 '05 #1
0 1241

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Pham Nguyen | last post by:
Has anyone seen an example of a textbox server control that has built-in client-side validation? I'd like to build a server control that extends the System.Web.UI.WebControls.TextBox class to allow...
3
by: A.M | last post by:
Hi, Can I use compare validator to make sure that the value of two text boxes are the same? Thanks, Alan
0
by: TN Bella | last post by:
Hi, I am trying to get my compare validator to fire properly...Since I have panels the validator wouldn't work properly, the app would fire right but would insert the data regardless and the...
3
by: Angelos Karantzalis | last post by:
Hi guys, I've a small problem with validators. I'm building a single .aspx file that handles all my form posts. I need to be using ASP.NET validators ( or subclasses thereof ), so what i do to...
3
by: Sandy | last post by:
Hi All! I have a password textbox and a verify password textbox. I threw in the compare validator to make sure both values agree. I noticed, however, that immediately the compare validator...
0
by: Stephen | last post by:
Can someone help me. I'm trying to use the following validator control and compare a date to a date defined in the code-behind page. My code is below along with my error message I get when the page...
3
by: thomson | last post by:
Hi, I have 5 aspx pages, In one page i have a Compare Validator Control, The four aspx pages are loading fast with similar controls, no code behind, But the page having Compare Validator Control...
0
by: RSH | last post by:
I have a situation where I am generating webcontrols dynamically from codebehind (1.1) Everything is working properly except that I am also attempting to add a Compare Validator which doesn't...
0
by: David Hearn | last post by:
I have a user control that I created that I use in one page right now. It has a textbox in it that is used to enter a date. I am using a compare validator to validate the date format which works...
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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.