6 Answers, 1 is accepted
To limit the range of selection, you should use the MinDate and MaxDate properties of RadDateTimePicker.
RadDateTimePicker uses internally a RadCalendar. You can access it as shown below:
RadCalendar calendar = (this.radDateTimePicker1.DateTimePickerElement.GetCurrentBehavior() as RadDateTimePickerCalendar).Calendar;
RadCalendar keeps a collection of the currently selected dates. You can access this collection using the SelectedDates property of RadCalendar. As a common collection, you can remove its items which are the selected dates.
I hope this helps. Do not hesitate to contact me if you need additional information.
Sincerely yours,
Boyko Markov
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
I'd like to just specific weekdays selectable - i.e. just Mondays. Is that possible?
Regards,
Daniel
You could subscribe to the SelectionChanging and SelectionChanged events of RadCalendar and add custom logic in the event handlers to remove certain dates from the SelectedDates collection or disable the corresponding cells in the RadCalendar.
You could also hide the days from the other months in RadCalendar To hide the other months days from the RadCalendar view, use the ShowOtherMonthsDays property of RadCalendar which is true by default.
I hope this helps. Contact me if you need additional information.
Best wishes,
Boyko Markov
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
Hello,
I try to limit the selectable Dates in the Calendar Control to 5, but the control does not render correct afterwards, it does not deselect the removed dates. When you switch do the next month and back to the selection, the controls displays the correct selection.
Sometimes it helps to switch the focus date to another date and then back to the current, but this doesn't work in every situation and it displays the date in different colors.
private void rc_MouseUp(object sender, MouseEventArgs e)
{
if (rc.SelectedDates.Count > 5)
{
rc.SelectedDates.Remove(rc.SelectedDates[5]);
DateTime temdate = rc.FocusedDate;
rc.FocusedDate = temdate.AddDays(1);
rc.FocusedDate = temdate;
}
}
Same behavior in other events like SelectionChanged, ...
I have just tested this issue with the latest version of RadCalendar Q3 Sp1 2009 and it seems to work properly. However, you can also try calling the InvalidateCalendar method to explicitly invalidate the calendar if it is necessary. Please contact us again if you have additional questions.
All the best,
Boyko Markov
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.