Validting selected date from a calendar

T

Tamer Ibrahim

how can I make sure that the user can't select a date earlier than the
today's date ?
 
N

Nathan Sokalski

There is the obvious choice of using the CustomValidator. What your other
options are depend on how the user is entering the date (Calendar control?
DropDownList? TextBox? custom control?). One option is to create your own
Validation control by inheriting from the BaseValidator class. Other options
might be using the RangeValidator by setting the MinimumValue to Date.Today
and MaximumValue to Date.MaxValue. There is also the CompareValidator in
which you could set ValueToCompare to Date.Today, Type to Date, and Operator
to GreaterThanEqual. Which one of these is best depends on what you are most
comfortable with and what control is being used to input the date. Good
Luck!
 
T

Tamer Ibrahim

I'm using just a calendar control to input the date and I can't make any of
the validation controls validate the selected date on the calendar. :(
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,020
Latest member
GenesisGai

Latest Threads

Top