RangeValidator Minimum Date can not be 01.01.0001

J

Johannes Hammersen

Hi,
when I try to set the Minimum Date on a RangeValidator to 01.01.0001 I get
an error, that 01.01.0001 can not be converted to a date.
But the DateType can be 01.01.0001. Convert.ToDateTime("01.01.0001") works.
So why can't I set the Minimum of the RangeValidator to that Date?

I have the same Problem with the Maximun Value. If I try to set that let's
say to the 31th December 9999 it will give me an error.

You can reproduce this error if you put an RangeValidator on a WebForm, set
it's type to Date an put 01.01.0001 as minimum value.

What am I doing wrong? Or is this a bug, and if yes does anyone know a
workaround?

Thanks for any help
Johannes Hammersen
 
C

Chris R. Timmons

Hi,
when I try to set the Minimum Date on a RangeValidator to
01.01.0001 I get an error, that 01.01.0001 can not be converted
to a date. But the DateType can be 01.01.0001.
Convert.ToDateTime("01.01.0001") works. So why can't I set the
Minimum of the RangeValidator to that Date?

I have the same Problem with the Maximun Value. If I try to set
that let's say to the 31th December 9999 it will give me an
error.

You can reproduce this error if you put an RangeValidator on a
WebForm, set it's type to Date an put 01.01.0001 as minimum
value.

What am I doing wrong? Or is this a bug, and if yes does anyone
know a workaround?

Johannes,

From the help file for RangeValidator.MaximumValue:

"Note If you specify ValidationDataType.Date for the
BaseCompareValidator.Type property without programmatically setting
the culture for the application, you should use a culture-neutral
format, such as YYYY/MM/DD, for the MaximumValue and MinimumValue
properties. Otherwise, the date may not be interpreted correctly."
 
J

Johannes Hammersen

Ah,

thanks that helps!
I thought I would just use the maschines settings like convert.to does.

Thank you
Johannes
 

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,767
Messages
2,569,571
Members
45,045
Latest member
DRCM

Latest Threads

Top