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'.
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'.