More than one decimal point

2 posts, 0 answers
  1. Matt
    Matt avatar
    32 posts
    Member since:
    May 2013

    Posted 31 Jan 2014 Link to this post

    Greetings,

    I am trying to figure out which input control to use.  We have numeric account numbers that can have zero to many decimal points.  For example...

    123456
    123.456
    12.345.6789
    1234.5.6

    These would all be valid account numbers.  I need to have an input that only allows numbers and periods.  Any advice?

    Much appreciated,

    Matt
  2. Matt
    Matt avatar
    32 posts
    Member since:
    May 2013

    Posted 31 Jan 2014 in reply to Matt Link to this post

    Never mind, I found the documentation about OnKeyPress. Here is what I used...

    <script type="text/javascript">
        function NumericPeriodOnly(sender, eventArgs) {
          var c = eventArgs.get_keyCode();
          if ((c < 48 || c > 57) && c !== 46)
            eventArgs.set_cancel(true);
        }
      </script>


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