Client OnKeyPress Backspace key

2 posts, 0 answers
  1. Frank
    Frank avatar
    4 posts
    Member since:
    Dec 2011

    Posted 22 Nov 2012 Link to this post

    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());
    <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? 

  2. Vasil
    Vasil avatar
    1540 posts

    Posted 22 Nov 2012 Link to this post

    Hi Frank,

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

    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.
  3. DevCraft R3 2016 release webinar banner
Back to Top