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

RadTimePicker in RadGridView

5 Answers 391 Views
Calendar, DateTimePicker, TimePicker and Clock
This is a migrated thread and some comments may be shown as answers.
Matthew Compton
Top achievements
Rank 1
Matthew Compton asked on 27 Apr 2012, 04:25 PM
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

5 Answers, 1 is accepted

Sort by
0
Accepted
Stefan
Telerik team
answered on 02 May 2012, 02:53 PM
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 >>
0
Matthew Compton
Top achievements
Rank 1
answered on 02 May 2012, 06:35 PM
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
0
Stefan
Telerik team
answered on 07 May 2012, 01:25 PM
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 >>
0
Matthew Compton
Top achievements
Rank 1
answered on 09 May 2012, 05:54 PM
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.
0
Accepted
Stefan
Telerik team
answered on 14 May 2012, 12:04 PM
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 >>
Tags
Calendar, DateTimePicker, TimePicker and Clock
Asked by
Matthew Compton
Top achievements
Rank 1
Answers by
Stefan
Telerik team
Matthew Compton
Top achievements
Rank 1
Share this question
or