This is a migrated thread and some comments may be shown as answers.
RadDatePicker DateInput-ClientEvents-OnKeyPress Not Firing For Enter Key (keycode 13)
3 Answers 122 Views
This is a migrated thread and some comments may be shown as answers.
Brian
Top achievements
Rank 1
Brian asked on 21 Jan 2010, 10:56 PM
Hello,

I would like to handle the OnKeyPress event to put focus on the next input control on the form when the enter key is pressed.  I have this working for textboxes and comboboxes, and can focus the dateinput in the datepicker, but the enter key is not firing the OnKeyPress client event for the datepicker's dateinput control.  The first debugger statement is hit when I enter a normal text key (e.g. '1', 'a'), but when hitting the enter key, nothing happens (the keyPressed_textbox function is never executed).  Any ideas why the enter key is not firing the event?


 
                                <telerik:RadDatePicker   
                                    DateInput-ClientEvents-OnKeyPress="keyPressed_textbox"   
                                    TabIndex="5"   
                                    runat="server"   
                                    ID="datepickerDob"   
                                    Width="180px"   
                                    MinDate="1/1/1900"   
                                    CssClass="body_copy" /> 

 
 
            function keyPressed_textbox(sender, args) {  
                debugger;  
                if ( 13 == args.get_keyCode() ) {  
 
                    /* never gets here for RadDatePicker's DateInput OnKeyPress event */ 
                }  
            } 

edit: I have a similar problem with RadComboBoxes that have MarkFirstMatch set to true - the enter key does not fire the OnClientKeyPressing event, but the event is fired when MarkFirstMatch is set to false.  Is there anything I can do about this?

3 Answers, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 26 Jan 2010, 12:35 PM
Hello Brian,

You could try to attach the KeyUp/KeyDown event instead:
<telerik:RadDatePicker
   TabIndex="5"
   runat="server"
   ID="datepickerDob"   
   Width="180px"
   onkeydown="keyDown(this, event)"
   MinDate="1/1/1900"
   CssClass="body_copy" />

<script type="text/javascript">
    function keyDown(sender, e)
    {
        e = e || window.event;
        if (e.keyCode == 13)
            //do something
    }
</script>

Let me know whether this helps.

Best regards,
Daniel
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.
0
Brian
Top achievements
Rank 1
answered on 26 Jan 2010, 08:58 PM
Using the key up event solved my issue with the RadDatePicker.  However, I still have an issue with RadComboxBox - when MarkFirstMatch = true and I have typed text into the RadComboBox or I have selected and item from the drop down list, I cannot focus another control from the key pressed or key up events.  I cannot blur the RadComboBox, either.  But, as I said, if MarkFirstMatch is false or there is no text in the RadComboBox, I can focus another control from these events.
0
Daniel
Telerik team
answered on 29 Jan 2010, 09:01 PM
Hello Brian,

Please test the attached demo and let me know whether it works properly on your end.

Best regards,
Daniel
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.
Asked by
Brian
Top achievements
Rank 1
Answers by
Daniel
Telerik team
Brian
Top achievements
Rank 1
Share this question
or