473,785 Members | 2,910 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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:CompareVal idator ID=cvDate Font-Size=small ForeColor=red Runat=server
ErrorMessage="P lease work" Operator=LessTh anEqual Type=Date
ControlToValida te=txtStartDate
ValueToCompare= "<%#CompareDate ()%>">*</asp:CompareVali dator>

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

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

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

Similar topics

2
3921
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 javascript checks for things like valid e-mail addresses or phone numbers (without having to add a separate control for validation). One idea I did some work on was having the control implement the IValidator interface and basically recreating...
3
1762
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
1629
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 user couldn't fix an error if they had an error. So I added another sub and fixed the panels, but the compare validator still doesn't work right. Right now the validator pops up with the error that the two values (txtAcctAmtSum and txtInvAmt) are...
3
1675
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 overcome the fact that i don't really know what sort of input controls I'm working with is this: 1) I've got the form description in xml, so I know all the fields I'm
3
2188
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 displays the error message before all the typing is completed in the "verify password" textbox. How do I get the compare to fire only when a person has completed the textbox? -- Sandy
0
320
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 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...
3
1950
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 is taking time, Any insights to this? Thanks in Advance thomson
0
1125
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 appear to be working, I get the error: " Unable to find control id '67:::EX' referenced by the 'ControlToValidate' property of ''. which makes sense, but it begs the question can this be done??
0
1407
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 fine if you enter a date and then use the tab key to leave the control. The problem is that it should also be firing if the date is not correctly formatted when the user clicks on a button that is in the parent page. The button has the...
0
9480
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10327
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10151
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10092
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8973
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5511
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4053
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3647
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2879
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.