RadTimePicker in RadGridView

6 posts, 2 answers
  1. Matthew Compton
    Matthew Compton avatar
    7 posts
    Member since:
    Aug 2012

    Posted 27 Apr 2012 Link to this post

    I have 4 DateTime Fields in my RadGridView.  StartDate, StartTime, EndTime, EndDate.  I need to be able to have a Time only picker when adding / editing in the grid.  I can't seem to find a way to use the RadTimePicker.  Is there a way to integrate this?  Or use the GridViewDateTimeColumn in such a manner?

    I'm Using WinForms Q1 2012 (2012.1.12.215) in a .NET 4.0 framework project.

    Thanks.  Matthew
  2. Answer
    Stefan
    Admin
    Stefan avatar
    2891 posts

    Posted 02 May 2012 Link to this post

    Hello Matthew,

    Thank you for writing.

    To achieve the desired behavior, you need to create a custom editor, based on RadTimePickerElement. In the attached project, you can find such an editor implemented. Feel free to customize and use it in your application.

    I hope that you find this information useful. Let us know if you have any other questions.

    Regards,
    Stefan
    the Telerik team
    RadControls for WinForms Q1'12 release is now live! Check out what's new or download a free trial >>
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Matthew Compton
    Matthew Compton avatar
    7 posts
    Member since:
    Aug 2012

    Posted 02 May 2012 Link to this post

    Thanks, that works but has changed all the pickers in the grid to a time picker. 

    I have two Fields that still require a DatePicker.   Can i use both in a the same gridview?

    Also, How do I force the time picker to use the 24 hour clock format?

    Thanks for your help.  Matthew
  5. Stefan
    Admin
    Stefan avatar
    2891 posts

    Posted 07 May 2012 Link to this post

    Hellow Matthew,

    Thank you for writing back.

    Indeed, the project changes all RadDateTimeEditors to TimePickerEditors. However, you can always check the CurrentColumn of the grid and change the editor type according it. I have changed the implementation of the desired functionality to use the embedded time picker editor instead of a custom one. Attached you can find a sample demonstrating how to use this approach, together with how to format the editor's time to 24 hour format. Then, if you want to set the cells format to 24 hour too, use the FormatString property of the column:
    col.FormatString = "{0:HH:mm}";

    Let me know how it works for you.
     
    Greetings,
    Stefan
    the Telerik team
    RadControls for WinForms Q1'12 release is now live! Check out what's new or download a free trial >>
  6. Matthew Compton
    Matthew Compton avatar
    7 posts
    Member since:
    Aug 2012

    Posted 09 May 2012 Link to this post

    Thanks, that did the trick as well.  One final question.  Is it possible to change the interval on the minute picker?  For instance change from every 5 minutes to every 1 minute.
  7. Answer
    Stefan
    Admin
    Stefan avatar
    2891 posts

    Posted 14 May 2012 Link to this post

    Hello Matthew,

    Yes, you can do that by setting the Step property of the element:
    element.Step = 1;

    I hope this helps.
     
    All the best,
    Stefan
    the Telerik team
    RadControls for WinForms Q1'12 release is now live! Check out what's new or download a free trial >>
Back to Top
UI for WinForms is Visual Studio 2017 Ready