hey..i would like to compare the current date with the date entered by user..however, i'm encountering errors so far..
i tried something like this:
<asp:textbox id="txtDate1" runat="server" />
<asp:comparevalidator runat="server" errormessage="The date must be greater than today" controltovalidate="txtDate1" type="date" valuetocompare="datetime.today.toshortdatestring()" />
and i got an error stating that the value of datetime.today.toshortdatestring() of the valuetocompare property of "" cannot be converted to type 'date'
i also tried valuetocompare="datetime.now.date()" and i got the same error message.
christina_ru...
Member
55 Points
100 Posts
date compare validator problem
May 31, 2007 02:25 AM|LINK
hey..i would like to compare the current date with the date entered by user..however, i'm encountering errors so far..
i tried something like this:
<asp:textbox id="txtDate1" runat="server" />
<asp:comparevalidator runat="server" errormessage="The date must be greater than today" controltovalidate="txtDate1" type="date" valuetocompare="datetime.today.toshortdatestring()" />
and i got an error stating that the value of datetime.today.toshortdatestring() of the valuetocompare property of "" cannot be converted to type 'date'
i also tried valuetocompare="datetime.now.date()" and i got the same error message.
please help me and i greatly appreciate it.