Programmatically set the SelectedTime

5 posts, 0 answers
  1. Frustrated Dev
    Frustrated Dev avatar
    35 posts
    Member since:
    Oct 2006

    Posted 15 Dec 2010 Link to this post


    I have C# application that uses the RadDatePicker and the RadTimePicker. Here is the XAML I will be referencing:
    <telerik:RadDatePicker x:Name="myDatePicker" DateTimeWatermarkContent="MM/DD/YY" />
    <telerik:RadTimePicker x:Name="myTimePicker" DateTimeWatermarkContent="HH:MM:SS" StartTime="0:0:0" EndTime="23:0:0" Culture="en-US" />

    I need to programmatically set the selected TIME of "myTimePicker". In an attempt to do this, I am using the following:
    myDatePicker.SelectedDate = MyDateTimeProp.Date;
    myTimePicker.SelectedTime = MyDateTimeProp.TimeOfDay;

    Oddly, the correct date appears in the RadDatePicker, but the time is not displayed in the RadTimePicker. How do I programmatically set the time displayed in the RadTimePicker? 

    Thank you
  2. Kaloyan
    Kaloyan avatar
    920 posts

    Posted 17 Dec 2010 Link to this post

    Hello Frustrated Dev,

    I have created a test demo project with the code posted by you and it appears that the control is working properly. The RadTimePickers updates the SelectedTime when a new value is assigned to it. Can you check if the following code is working on your side:  myTimePicker.SelectedTime = DateTime.Now.TimeOfDay

    Kind regards,
    the Telerik team
    Browse the videos here>> to help you get started with RadControls for Silverlight
  3. DevCraft R3 2016 release webinar banner
  4. mudassir
    mudassir avatar
    1 posts
    Member since:
    Apr 2008

    Posted 11 Feb 2013 Link to this post

    how to set time programmatically in RadTimePicker


  5. Thomas
    Thomas avatar
    18 posts
    Member since:
    Jun 2010

    Posted 02 Jul 2014 Link to this post


    I use RadTimePicker in my custom EditingAppointment from RadScheduleView.
    When i try to set Time in code behind with this code :

    timePickerHeureDebut.SelectedDate = scheduler.SelectedSlot.Start;
    timePickerHeureDebut.SelectedTime = scheduler.SelectedSlot.Start.TimeOfDay;

    Sometimes, time is not set and is null.
    In debug mode, it is still null after execution of this two lines. It don't append every times.

  6. Yana
    Yana avatar
    4547 posts

    Posted 03 Jul 2014 Link to this post

    Hi Thomas,

    The provided code seems correct and I am not sure what could cause such an issue. Could you please open a support ticket and send us some sample code there, so we to be able to test the case and provide further assistance?

    Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
Back to Top
DevCraft R3 2016 release webinar banner