Click here to Skip to main content
15,888,195 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more: , +
XML
<asp:TextBox ID="txt_dateofjoin" runat="server" />
<cc1:CalendarExtender ID="cal2" runat="server" TargetControlID="txt_dateofjoin" Format="dd-MM-yyyy" TodaysDateFormat="dd-MM-yyyy"></cc1:CalendarExtender>

<asp:TextBox ID="txt_confirmationdate" runat="server" />
<cc1:CalendarExtender ID="cal" runat="server" Format="dd-MM-yyyy" TargetControlID="txt_confirmationdate" TodaysDateFormat="dd-MM-yyyy">
</cc1:CalendarExtender>

<asp:CompareValidator ID="cmpDates" runat="server" ControlToCompare="txt_dateofjoin" ControlToValidate="txt_confirmationdate" Operator="GreaterThan" Type="Date" SetFocusOnError="true" Display="Dynamic" Text="Confirm Date must be greater than Joining Date" />


when I change the Format of CalendarExtender to MM-dd-yyyy then it works fine but in dd-MM-yyyy compare validator consider date to month. Now how I can validate this two date in dd-MM-yyyy format.
Posted

Hi,
Try setting the property CultureInvariantValues="true" in your CompareValidator .

--Amit
 
Share this answer
 
Comments
Dinesh Ambaliya 20-Aug-12 1:35am    
it's not work!
Rewrite your tag for calender extender in following way its solved your problem...

XML
<cc1:CalendarExtender ID="cal2" runat="server" TargetControlID="txt_dateofjoin"
Format="dd/MM/yyyy" TodaysDateFormat="dd/MM/yyyy"></cc1:CalendarExtender>
 
Share this answer
 

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