This is a migrated thread and some comments may be shown as answers.

SelectableDateStart behavior

1 Answer 73 Views
Calendar
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Alex
Top achievements
Rank 1
Alex asked on 14 Sep 2013, 07:17 PM
Hi there!
I have a calendar and I'm setting SelectableDateStart  and SelectableDateEnd

If I set SelectableDateEnd using following code:
SelectableDateEnd = new DateTime(2013, 10, 6);
then I can select 6th of October

If I set SelectableDateEnd using following code:
SelectableDateEnd = new DateTime(2013, 10, 6, 11, 0, 0);
then I cannot select 6th of October, only 7th.

Please, explain why Calendar behaves like this.

Thank you.

1 Answer, 1 is accepted

Sort by
0
Accepted
Todor
Telerik team
answered on 18 Sep 2013, 07:36 AM
Hello Alex,

Thank you for your question.

If you set the SelectableDateEnd to either of the two values that you mentioned, the result is the same: 6th of October is the last selectable date and 7th is not selectable.

I assume you mean that you want to change the SelectableDateStart. When you select a date in RadCalendar, its SelectedValue has the date that you selected but the time has its default value of 12:00 AM. This means that when you set you selectable dates range, the actually selectable values are the dates where 12:00 AM is included in the range.

For example if you selectable range is defined like this:

calendar.SelectableDateStart = new DateTime(2013, 10, 6, 11, 0, 0);
calendar.SelectableDateEnd = new DateTime(2013, 10, 13, 11, 0, 0);

Then 6th of October is not selectable, because the DateTime object (2013, 10, 6, 0, 0, 0), which would be the selected value if the date was selected, is out of the defined range.

If you have another DateTime value that you want to use for the SelectableDateStart and you would like to have it included you can use its Date component only:

calendar.SelectableDateStart = MyDateTimeValue.Date;

If you have another scenario where it makes more sence to have the SelectableDateStart set to specific part of the day, please explain it in more details.

I hope this information helps and now RadCalendar's behavior makes more sense.
 
Regards,
Todor
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WINDOWS PHONE 7.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
Tags
Calendar
Asked by
Alex
Top achievements
Rank 1
Answers by
Todor
Telerik team
Share this question
or