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

Disable Saturday and Sunday on RadDateTimePicker

2 Answers 201 Views
Calendar, DateTimePicker, TimePicker and Clock
This is a migrated thread and some comments may be shown as answers.
tran
Top achievements
Rank 1
tran asked on 17 Dec 2010, 11:06 AM
Hi guys.Can you tell me how to disable or remove Saturday and Sunday on RadDateTimePicker. I mean that user can see Saturday and Sunday when click on drop down button but can not select it.

I have already referenced how to disable Saturday and Sunday with RadCalendar. However I want to make the same on RadDateTimePicker

Another things, How to limit time in RadDateTimePicker.For example, I want user to choose from 8 am to 5:30 pm and other hours user can not choose.

Thanks

Tran Dat

2 Answers, 1 is accepted

Sort by
0
Richard Slade
Top achievements
Rank 2
answered on 19 Dec 2010, 06:28 PM
Hello Tran,

This wold help with your first issue. I will look into the second one for you as soon as possible
Private Sub Calendar_Opened(ByVal sender As Object, ByVal e As EventArgs)
    Dim table As CalendarTableElement = TryCast(TryCast(Me.RadDateTimePicker1.DateTimePickerElement.GetCurrentBehavior(), RadDateTimePickerCalendar).Calendar.CalendarElement.CalendarVisualElement.Children(0).Children(1), CalendarTableElement)
    For Each cell As CalendarCellElement In table.Children
        cell.Enabled = True
        If cell.[Date].DayOfWeek = DayOfWeek.Saturday Or cell.[Date].DayOfWeek = DayOfWeek.Sunday Then
            cell.Enabled = False
        End If
    Next
End Sub
Richard
0
Richard Slade
Top achievements
Rank 2
answered on 19 Dec 2010, 11:17 PM
Event Handler for the above missed before.
AddHandler Me.RadDateTimePicker1.DateTimePickerElement.Opened, AddressOf Calendar_Opened

Richard
Tags
Calendar, DateTimePicker, TimePicker and Clock
Asked by
tran
Top achievements
Rank 1
Answers by
Richard Slade
Top achievements
Rank 2
Share this question
or