Radtextbox limit to one word?

3 posts, 1 answers
  1. Alan T
    Alan T avatar
    125 posts
    Member since:
    Apr 2010

    Posted 21 Jul 2011 Link to this post

    Hi there,

    is it possible using either radtextbox, or radmaskedtextbox to limit the input to only one word ?

    Regards,

    Alan
  2. Answer
    Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 25 Jul 2011 Link to this post

    Hello Alan,

    You can achieve this by attaching ClientEvent OnKeyPress to the RadTextBox. Here is the sample code that I tried which worked as expected.

    Javascript:
    <script type="text/javascript">
      function OnKeyPress(sender,args)
    {
      var c=args.get_keyCode();
      if (c==32)
      {
      args.set_cancel(true);
      }
     }
    </script>

    Thanks,
    Shinu
  3. Alan T
    Alan T avatar
    125 posts
    Member since:
    Apr 2010

    Posted 25 Jul 2011 Link to this post

    thankyou for the response Shinu. great forum.
Back to Top