Declined
Last Updated: 20 Jan 2015 16:14 by ADMIN
Theodoros
Created on: 28 Jan 2013 05:08
Category: UI for ASP.NET AJAX
Type: Bug Report
0
raddatepicker focused date not enforced via code behind
The focused date for the calendar is not applied initially when setting it via code behind.

If I do this via code behind:
            theControl.Calendar.RangeMinDate = new DateTime(2012, 1, 1);
            theControl.Calendar.RangeMaxDate = new DateTime(2012, 12, 31);
            theControl.Calendar.FocusedDate = new DateTime(2012, 1, 2);

When clicking on the button to select a date, I get a "Date is out of range" message box. but then it still allows me to pick a date.

The only workaround I have been able to use right now is to set the Focused date in the markup. This will allow the selection without the popup.
1 comment
ADMIN
Vasil
Posted on: 13 Feb 2013 12:58
You are getting this exception because when you set:
theControl.Calendar.RangeMinDate = new DateTime(2012, 1, 1);
The current selected date is out of range, for example DateTime(2010, 2, 2);

The correct way of selecting the date will be:
theControl.Calendar.SelectedDate = null;
theControl.Calendar.FocusedDate = null;
theControl.Calendar.RangeMinDate = new DateTime(2012, 1, 1);
theControl.Calendar.RangeMaxDate = new DateTime(2012, 12, 31);
theControl.Calendar.FocusedDate = new DateTime(2012, 1, 2);

If your old selected date is in the new range, then you dont need to make it null.