Solved

Compare validator asp.net

Posted on 2014-02-11
1
202 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 AD Toolbox Looking More Like a Toybox?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

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

Today is the age of broadband.  More and more people are going this route determined to experience the web and it’s multitude of services as quickly and painlessly as possible. Coupled with the move to broadband, people are experiencing the web via …
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

770 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