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

Programmatically set the SelectedTime

4 Answers 274 Views
TimePicker
This is a migrated thread and some comments may be shown as answers.
Frustrated Dev
Top achievements
Rank 1
Frustrated Dev asked on 15 Dec 2010, 09:19 PM
Hello,

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

4 Answers, 1 is accepted

Sort by
0
Kaloyan
Telerik team
answered on 17 Dec 2010, 01:04 PM

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,
Kaloyan
the Telerik team
Browse the videos here>> to help you get started with RadControls for Silverlight
0
mudassir
Top achievements
Rank 1
answered on 11 Feb 2013, 01:55 PM

how to set time programmatically in RadTimePicker

EG:

RadTimePicker.SelectedDate=Convert.ToDateTime("00.00.02");
0
Thomas
Top achievements
Rank 1
answered on 02 Jul 2014, 09:34 AM
Hi, 

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.

0
Yana
Telerik team
answered on 03 Jul 2014, 10:49 AM
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?

Regards,
Yana
Telerik
 
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.
 
Tags
TimePicker
Asked by
Frustrated Dev
Top achievements
Rank 1
Answers by
Kaloyan
Telerik team
mudassir
Top achievements
Rank 1
Thomas
Top achievements
Rank 1
Yana
Telerik team
Share this question
or