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

disabling dates in a DateTimePicker Control

1 Answer 112 Views
Calendar, DateTimePicker, TimePicker and Clock
This is a migrated thread and some comments may be shown as answers.
Anjan Guha
Top achievements
Rank 1
Anjan Guha asked on 27 Jul 2009, 10:32 AM
Hi
I want to disable all days except Monday for all Months in RAD dateTimePicker. I have wriiten the following Code but still able to select dates other than Monday... 

public Form1()
        {
            InitializeComponent();
            this.radDateTimePicker1.DateTimePickerElement.Opened +=new EventHandler(DateTimePickerElement_Opened);
           

   

        }

        private void DateTimePickerElement_Opened(object sender, EventArgs e)
        {
            CalendarTableElement table = ((this.radDateTimePicker1.DateTimePickerElement.GetCurrentBehavior() as
                RadDateTimePickerCalendar).Calendar.CalendarElement.CalendarVisualElement.Children[0].Children[1] as
                CalendarTableElement);
            foreach (CalendarCellElement cell in table.Children)
            {
                cell.Enabled = true;
               
                if (cell.Date.DayOfWeek != DayOfWeek.Monday)
                {
                    cell.Enabled = false;
                                     

                }

            }

1 Answer, 1 is accepted

Sort by
0
Boyko Markov
Telerik team
answered on 29 Jul 2009, 04:45 PM
Hello Anjan Guha,

This is not possible in the current version of the control and there is no workaround of this. However in the SP1 release this week we will disallow the selection  of disabled cells.

If you need more information please write me back.


All the best,
Boyko Markov
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
Calendar, DateTimePicker, TimePicker and Clock
Asked by
Anjan Guha
Top achievements
Rank 1
Answers by
Boyko Markov
Telerik team
Share this question
or