Enter only numbers

2 posts, 0 answers
  1. Tina
    Tina avatar
    130 posts
    Member since:
    Jul 2011

    Posted 23 Oct 2011 Link to this post

    How can I make RadTextBox enter only numbers?
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 23 Oct 2011 Link to this post

    Hello Tina,

    You can achieve this by attaching the client event OnKeyPress. Here is the sample code.
    <telerik:RadTextBox ID="RadTextBox1" runat="server" >
        <ClientEvents OnKeyPress="keyPress"/>
    </telerik:RadTextBox >

    <script type="text/javascript">
      function keyPress(sender, args)
        var text = sender.get_value() + args.get_keyCharacter();
        if (!text.match('^[0-9]+$'))

  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top