How to restrict keys of Numpad in Rad Editor

3 posts, 1 answers
  1. UMA MAHESWARA RAO
    UMA MAHESWARA RAO avatar
    8 posts
    Member since:
    Jul 2011

    Posted 30 Jan 2012 Link to this post

    Hello Everyone,
    I need to restrict the Numpad keys to enter in the Rad Editor.
  2. Answer
    Rumen
    Admin
    Rumen avatar
    14351 posts

    Posted 30 Jan 2012 Link to this post

    Hi,

    You can see how to attach to the onkeydown event and check the key number in this demo: attachEventHandler.
    You can prevent the key execution with $telerik.cancelRawEvent(e);

    Kind regards,
    Rumen
    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. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 30 Jan 2012 Link to this post

    Hello Uma,

    Try the following Javascript to restrict keys of Numpad
    JS:
    <script type="text/javascript">
    function OnClientLoad(editor, args)
    {
     editor.attachEventHandler("onkeydown", function (e)
      {
       if (e.keyCode > 95 && e.keyCode <= 105)
       {
          return false;
       }
       else
       {
         return true;
       }
      });
    }
    </script>

    -Shinu.
Back to Top