Solved

Compare validator asp.net

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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

735 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