Solved

Compare validator asp.net

Posted on 2014-02-11
1
201 Views
Last Modified: 2014-02-12
I have a date text box which gets populated by a date picker.I want to check and see if the date entered is not more then one year starting from today;s date. so if today is 2-10-14 and if date entered in that text box is 2-11-15 then i need the validator to throw an error. how do i do that

                        <asp:CompareValidator ID="cvcalBondEffDt" Text="*" Operator="DataTypeCheck" EnableClientScript="true"
                            runat="server" ErrorMessage="Invalid Effective date." ControlToValidate="calBondEffDt"
                            Type="Date" Display="Dynamic">
                        </asp:CompareValidator>
0
Comment
Question by:pratikshahse
1 Comment
 
LVL 14

Accepted Solution

by:
dejaanbu earned 500 total points
ID: 39853105
Set the valuetocompare property to one year + todays date in page_load event.
Then set the operator property to "lessthan"
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses the ASP.NET AJAX ModalPopupExtender control. In this article we will show how to use the ModalPopupExtender control, how to display/show/call the ASP.NET AJAX ModalPopupExtender control from javascript, how to show/display/cal…
User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…
Internet Business Fax to Email Made Easy - With  eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, f…

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now