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

5 posts, 0 answers
  1. Rod
    Rod avatar
    15 posts
    Member since:
    Jun 2011

    Posted 04 Jul 2013 Link to this post

    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.
  2. George
    Admin
    George avatar
    1332 posts

    Posted 09 Jul 2013 Link to this post

    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 >>
  3. UI for WPF is Visual Studio 2017 Ready
  4. Rod
    Rod avatar
    15 posts
    Member since:
    Jun 2011

    Posted 13 Jul 2013 Link to this post

    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?
  5. George
    Admin
    George avatar
    1332 posts

    Posted 15 Jul 2013 Link to this post

    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 >>
  6. Rod
    Rod avatar
    15 posts
    Member since:
    Jun 2011

    Posted 15 Jul 2013 Link to this post

    Ah, I hadn't thought of that. Good idea, George, I'll give that a try.
Back to Top
UI for WPF is Visual Studio 2017 Ready