Selecting only time of day through RadDateTimePickerElement

4 posts, 0 answers
  1. Indranik
    Indranik avatar
    40 posts
    Member since:
    Nov 2008

    Posted 10 May 2009 Link to this post

    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.
  2. Nikolay
    Admin
    Nikolay avatar
    1803 posts

    Posted 13 May 2009 Link to this post

    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.
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Johan Bjerling
    Johan Bjerling avatar
    4 posts
    Member since:
    Aug 2009

    Posted 09 Oct 2009 Link to this post

    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?
  5. Nikolay
    Admin
    Nikolay avatar
    1803 posts

    Posted 16 Oct 2009 Link to this post

    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.
Back to Top