Calendar Control: Breaks if set to December 9999

N

Nathan Pickett

Hi-



The following exception is being throw when I set the ASP.NET Calendar
control to December 1, 9999 (end of time):



Specified argument was out of the range of valid values. Parameter name:
Year, Month, and Day parameters describe an unrepresentable DateTime.



I believe that this is because when the control renders the title, the value
for the navigation's next month is not a valid DateTime since it is greater
than the DateTime.MaxValue (23:59:59.9999999, December 31, 9999).



To resolve this issue I am currently using Regular Expressions to validate
the input for the intial date. If the date is greater than December 9999 ,
I am assigning the Calendar's TodaysDate property to November, 30 9999 in
the Page_Load. I am also doing this check in VisibleMonthChanged event.
This disallows the Calendar to render a view greater than November 9999.



It would make more sense to the user if the next month navigation is disable
or removed from the title navigation for December 9999. Is there a way to
prevent the next month navigation element from rendering if the date is
December 9999? Preferable without extending the Calendar control.



Thanks! -Nate
 

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,764
Messages
2,569,566
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top