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

Selecting only time of day through RadDateTimePickerElement

3 Answers 397 Views
Calendar, DateTimePicker, TimePicker and Clock
This is a migrated thread and some comments may be shown as answers.
Indranik
Top achievements
Rank 1
Indranik asked on 10 May 2009, 04:43 PM
Hi,
In my form at some event I am adding a RadDateTimePickerElement to a cell of a gridview. The RadDateTimePickerElement shows date picker. However my requirement is such that I want to show only a timepicker and want to select a specific time of day. But currently it allows me to select days and not time. I want tp select time of day.

3 Answers, 1 is accepted

Sort by
0
Nikolay
Telerik team
answered on 13 May 2009, 04:37 PM

Hi Indranik,

Thank you for contacting us.

In order to show only time you should use the following properties of RadDateTimePickerElement:

1. Set the ShowUpDown property to true
2. Set the Format property to Time

Please contact me again if you have more questions.

Regards,

Nikolay
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Johan Bjerling
Top achievements
Rank 1
answered on 09 Oct 2009, 03:45 PM
Thought I'd nick this old thread as it posses allmost the same question as me. 

Only I'm interested in getting a TimePicker with a GridViewDateTimeColumn instead.
Is this possible? I couldn't find any info more relevant than that in this thread when I did a search.

In addition, whilst on the subject of GridViewDateTimeColumn, can one limit the range of dates or perhaps disable future dates in said column?
0
Nikolay
Telerik team
answered on 16 Oct 2009, 12:34 PM
Hi Johan Bjerling,

Thank you for the questions.

RadDateTimePicker does not support picking up only a date from a dropdown. Currently, we do not have certain plans about developing such feature, but if more customers request it, we will raise its priority.

As to your second question, you can limit the range of dates by setting MinDate and MaxDate properties of the RadDateTimePickerEditorElement in the CellEditorInitialized event handler. An example of setting properties in the CellEditorInitialized event handler is placed in this help article. In your case the code for setting MinDate and MaxDate will look like this:
void radGridView1_CellEditorInitialized(object sender, Telerik.WinControls.UI.GridViewCellEventArgs e)
{
    RadDateTimeEditor editor = this.radGridView1.ActiveEditor as RadDateTimeEditor;
    if (editor != null)
    {
        ((RadDateTimeEditorElement)((RadDateTimeEditor)this.radGridView1.ActiveEditor).EditorElement).MinDate = new DateTime(2009, 01, 01);
        ((RadDateTimeEditorElement)((RadDateTimeEditor)this.radGridView1.ActiveEditor).EditorElement).MaxDate = new DateTime(2009, 12, 12);
    }
}

I hope this helps. If you have additional questions, feel free to contact me.

Best wishes,
Nikolay
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
Calendar, DateTimePicker, TimePicker and Clock
Asked by
Indranik
Top achievements
Rank 1
Answers by
Nikolay
Telerik team
Johan Bjerling
Top achievements
Rank 1
Share this question
or