Edit this page

Selection

The RadDateTimePicker lets you select only single values - a single date, month or year from the Calendar and/or a single time from the Clock.

You can customize the selection mode in the calendar view via the DateSelectionMode property. The default behavior is that you can choose from dates. Read more here

Selecting an Item Declaratively and Programmatically

The following properties hold the information about the selection in the RadDateTimePicker control:

  • SelectedValue - gives you a DateTime representation of the selected date and time or null if no value has been selected.

  • SelectedDate - it is the DateTime that corresponds to the user selected date or null, if no value has been selected.

  • SelectedTime - it is of type TimeSpan? and corresponds to the selected time representation in the clock view of the control or null if no time has been selected.

  • <telerik:RadDateTimePicker x:Name="radDateTimePicker"
       SelectedDate="11/15/2010"
       SelectedTime="10:00"/>
    

    this.radDateTimePicker.SelectedValue = new DateTime(2010, 1, 5, 10, 0, 0);
    
    Me.radDateTimePicker.SelectedValue = New DateTime(2010, 1, 5, 10, 0, 0)
    

Restricting the date item's selection

In the RadDateTimePicker's calendar you can restrict the selectable items by using the following properties:

  • SelectableDateStart - this is the first selectable date in the RadDateTimePicker calendar that a user will be able to select.

  • SelectableDateEnd - this is the last selectable date in the RadDateTimePicker calendar that a user will be able to select.

<telerik:RadDateTimePicker x:Name="radDateTimePicker1" 
   SelectableDateStart="8/10/2010"
   SelectableDateEnd="10/10/2010"/>

The date items that are after the SelectableDateEnd will still be visible but the user will not be able to select them.

You can also decide not to display date items that cannot be selected (located after the SelectableDateEnd value). You can do this via the DisplayDateStart and DisplayDateEnd properties. Read more here

Restricting the time item's selection

In the RadDateTimePicker's clock view you can restrict the selectable time items by using the StartTime and EndTime properties. You can even fill the Clock with a custom collection of TimeSpan objects. Read more here

Restricting the date and time item's selection from the input box

Telerik introduced the IsInputRestrictedToSelectableDates boolean property in Q1 2016 of UI for Silverlight. By using it you could easily restrict the user from selecting a date based on the entered text inside the input area of the control. The selectable range is defined by the values set for the SelectableDateStart and SelectableDateEnd properties.

<telerik:RadDateTimePicker x:Name="radDateTimePicker2" 
   SelectableDateStart="8/10/2015"
   SelectableDateEnd="10/11/2015"
   IsInputRestrictedToSelectableDates="True"/>

See Also

Was this article helpful? Yes No

Give article feedback

Tell us how we can improve this article

Dummy