Solved

Compare validator asp.net

Posted on 2014-02-11
1
200 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

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

743 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

9 Experts available now in Live!

Get 1:1 Help Now