Link to home
Start Free TrialLog in
Avatar of TrialUser
TrialUserFlag for Afghanistan

asked on

compare validator to compare if text in textbox is less than or = today

I am trying to validate the user entry is <= today. I have the following validator.
It is not working properly though. Whether I enter < or > today it is giving the error message. please help. thanks

<asp:CompareValidator ID="cmpOrderFrom" ControlToValidate ="txtOrderFrom"  Display="None" ErrorMessage = "• OrderFrom must be older than or equal to today's date" Operator="LessThanEqual" runat="server" valuetocompare='<%= DateTime.Now.ToShortDateString() %>' />
                    <asp:CompareValidator ID="cmpOrderTo" ControlToValidate ="txtOrderTo"  Display="None" ErrorMessage = "• OrderTo must be older than or equal to today's date" Operator="LessThanEqual" runat="server"    valuetocompare='<%= DateTime.Now.ToShortDateString() %>' />
ASKER CERTIFIED SOLUTION
Avatar of disrupt
disrupt
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of TrialUser

ASKER

thanks a ton this works perfectly