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

Client OnKeyPress Backspace key

1 Answer 410 Views
Input
This is a migrated thread and some comments may be shown as answers.
Dirk
Top achievements
Rank 1
Dirk asked on 22 Nov 2012, 02:16 PM
I am having problems with the client side events. Im trying to fire a javascript whenever a key is pressed:
<script language="javascript" type="text/javascript">
   
        function tbGroupNamekeypress(sender, eventArgs) {
            var c = eventArgs.get_keyCharacter();
            var idtbGroupname = '<%=tbGroupName.ClientID%>';
            var tbGroupnameValue = encodeURI($('#' + idtbGroupname).val() + c);
            $('#divGroupNamePreview').load("/_layouts/checkGroupName.aspx?name=" + tbGroupnameValue + "&t=" + new Date().getTime());
        }
 </script>
 
<telerik:RadTextBox runat="server" ID="tbGroupName" Width="79%" Skin="Metro" ClientEvents-OnKeyPress="tbGroupNamekeypress" MaxLength="47"></telerik:RadTextBox>

this works for all keys except the backspace key. Is there any workaround for this? 

Regards,
Frank

1 Answer, 1 is accepted

Sort by
0
Vasil
Telerik team
answered on 22 Nov 2012, 03:51 PM
Hi Frank,

You can handle directly the onkeydown event:
<script......>
 
function handleKeyDown(inputElement, eventArgs)
{
    var TextBox = $find(inputElement.id);
}
 
</script>
 
<telerik:RadTextBox runat="server" ID="tbGroupName" onkeydown = "handleKeyDown(this,event)"></telerik:RadTextBox>


Regards,
Vasil
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
Input
Asked by
Dirk
Top achievements
Rank 1
Answers by
Vasil
Telerik team
Share this question
or