Client Keyboard Shortcut TimePicker

2 posts, 0 answers
  1. Bill
    Bill avatar
    96 posts
    Member since:
    Aug 2006

    Posted 30 Apr 2010 Link to this post

    I'm using the TimePicker, and was wondering if there is a way to simply type "n" for "now" (current datetime)?
    Are there any shortcuts for the control?
    I want the input empty until they enter a time. I do not want it to default to today or anything.
    Thanks in advance for the suggestions.
    ~bg
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 03 May 2010 Link to this post

    Hello Bill,

    You can add the OnKeyPress event to RadTimePicker, and select the custom time according to the key pressed. Here is an example.

    APSX:

     
    <telerik:RadTimePicker ID="RadTimePicker1" runat="server">  
        <DateInput>  
            <ClientEvents OnKeyPress="OnKeyPress" />  
        </DateInput>  
    </telerik:RadTimePicker> 

    JavaScript:

     
        var timepicker;  
        var dt = new Date();  
        function OnKeyPress(sender, args) {  
            timepicker = sender;  
            if (args.get_keyCode() == 110) {  
                setTimeout("timepicker.set_selectedDate(dt);", 100);  
            }  
        }  

    -Shinu.

Back to Top