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

Is the DateTimePicker control the wrong control for Time(7) data type?

4 Answers 113 Views
DateTimePicker
This is a migrated thread and some comments may be shown as answers.
Rod
Top achievements
Rank 1
Rod asked on 05 Jul 2013, 12:29 AM
I've got a table in a SQL Server 2008 R2 database, that is a Time(7) data type. It is meant to hold the length of time of another data element. I am trying to using a DateTimePicker control, with the InputMode set to Time, so collect this data. I'm wondering if perhaps I should be using a different control, because when I tried saving the data, it didn't save it to the database.

4 Answers, 1 is accepted

Sort by
0
George
Telerik team
answered on 09 Jul 2013, 11:38 AM
Hi Rod,

RadDateTimePicker control has three selection properties - SelectedValue, SelectedDate and SelectedTime. In the given scenario I would suggest using the SelectedTime property which is a type of TimeSpan?. For more information about RadDatePicker selection, you could refer to the following documentation article - http://www.telerik.com/help/wpf/raddatetimepicker-features-selection.html

Hope this helps.


Regards,
George
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
0
Rod
Top achievements
Rank 1
answered on 13 Jul 2013, 05:22 PM
Hi George,

I think what you've said is what I need to do, and so I changed it to SelectedTime, but it didn't work. To make it easier, here's the XAML:

<telerik:RadDateTimePicker InputMode="TimePicker" SelectedTime="{Binding PlayTime}" Name="radPlayTime" DateTimeWatermarkContent="Enter how long the episode/movie is" />

I'm sure I'm still doing something wrong, but am not sure what it is. What is it do you think I've left off/out?
0
George
Telerik team
answered on 15 Jul 2013, 12:19 PM
Hello Rod,

In order to update the source in the ViewModel, I would suggest using two-way binding for SelectedTime property: SelectedTime="{Binding PlayTime, Mode=TwoWay}".

Hope this helps.

Regards,
George
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
0
Rod
Top achievements
Rank 1
answered on 16 Jul 2013, 01:34 AM
Ah, I hadn't thought of that. Good idea, George, I'll give that a try.
Tags
DateTimePicker
Asked by
Rod
Top achievements
Rank 1
Answers by
George
Telerik team
Rod
Top achievements
Rank 1
Share this question
or