help in compare validate in c#
Posted
by scatman
on Stack Overflow
See other posts from Stack Overflow
or by scatman
Published on 2010-04-16T07:05:26Z
Indexed on
2010/04/16
7:33 UTC
Read the original article
Hit count: 235
i have 2 textboxes that i am filling with StartDate, and Endate.
i want to use the compareValidator to make sure that the StartDate is less that the EndDate. i used this:
<asp:CompareValidator ID="Comp" ControlToValidate="txtStartDate" ControlToCompare="txtEndDate" Operator="LessThan" Type="Date" runat="server" Display="dynamic" Text="Failed!" />
the validator is always giving me Failed no matter what the dates are. if startdate>endate or vise versa, Failed appears.
i am using (MM/dd/yyyy) format in the textboxes.
EDIT: ok i solved the problem. if anyone interested here is the new comparevalidator:
<asp:CompareValidator ID="Comp" ControlToValidate="txtEndDate" ControlToCompare="txtStartDate" Operator="GreaterThan" Type="Date" runat="server" Display="dynamic" Text="Failed!" />
© Stack Overflow or respective owner