4
Reply

How to check dates

Ask a question
Sameer Khan

Sameer Khan

8 years ago
342
1
How to check date should not be greater than today date using compare field validator i:e Client side validation in asp .net
 
I have used this
<asp:comparevalidator ID="Comparevalidator2" runat="server" errormessage="The date must be greater than today"
controltovalidate="txtRegDate" type="Date" Operator="GreaterThan"
valuetocompare='<%= DateTime.Now.ToShortDateString() %>' />
 
Getting Error
 
The value '<%= DateTime.Now.ToShortDateString() %>' of the ValueToCompare property of 'Comparevalidator2' cannot be converted to type 'Date'. 

Answers (4)