Todays date in range validator?

T

Tarun Mistry

Hi everyone, i have a range validator set to date mode. However, I want the
max date to be whatever it is right now, is there a way of setting this
within the properties of the range validator?

Thanks,
Taz
 
P

Peter Blum

Of course. You can set any property you want programmatically. All you need
to know is the string that goes into RangeValidator.Maximim which is
compatible with its Type property. (Type=Date in this case.)

In Page_Load, use:

RangeValidator1.Maximum = DateTime.Today.ToShortDateString()

--- Peter Blum
www.PeterBlum.com
Email: (e-mail address removed)
Creator of "Professional Validation And More" at
http://www.peterblum.com/vam/home.aspx
 

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

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,565
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top