Disable Saturday and Sunday on RadDateTimePicker

3 posts, 0 answers
  1. tran
    tran avatar
    8 posts
    Member since:
    Oct 2010

    Posted 17 Dec 2010 Link to this post

    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. Richard Slade
    Richard Slade avatar
    3000 posts
    Member since:
    May 2009

    Posted 19 Dec 2010 Link to this post

    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
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Richard Slade
    Richard Slade avatar
    3000 posts
    Member since:
    May 2009

    Posted 19 Dec 2010 Link to this post

    Event Handler for the above missed before.
    AddHandler Me.RadDateTimePicker1.DateTimePickerElement.Opened, AddressOf Calendar_Opened

    Richard
Back to Top