Click here to Skip to main content
16,019,018 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Two textboxes startdate and end date. I require value in the end date textbox greater than start date. I use:=--
XML
<asp:CompareValidator ID="CompareValidator4" runat="server"
                    ControlToCompare="TxtEveryDayStartDate" ControlToValidate="TxtEveryDayEndDate"
                    CultureInvariantValues="True" ValidationGroup="Date"
                    ErrorMessage="Date should be greater than start date."
                    Operator="GreaterThan" SetFocusOnError="True"></asp:CompareValidator>



But when we enter value using calender control, date like 26 july 2014 and 1 aug 2014, it gives error message but actully 1 aug is greater. Solve this plz.
Posted

In VB.net i use following code...try to use this logic

VB
If Date.Parse(startdate) > Date.Parse(enddate) Then
    MsgBox("true")
End If
 
Share this answer
 
Comments
Member 10410576 20-Jul-14 9:23am    
I used a compare validator to enter value in textbox.
Start date=21-July-2014
End date=01-Aug-2014
Means End date Actully greater. But it gives error message 'Date should be greater than start date.'.
Plz solve.
nilesh sawardekar 20-Jul-14 9:57am    
looks like your facing problem because of format of date.. try formats like '"MM\/dd\/yyyy"'

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900