Rad Numeric Textbox truncates non numeric characters

4 posts, 0 answers
  1. Justin
    Justin avatar
    2 posts
    Member since:
    Aug 2012

    Posted 10 Aug 2012 Link to this post

    I have a warehouse application that receives input from a scanner to a Rad Numberic Textbox. The issue I'm having is if the user scans a string like 'GEB34HT3' into the numeric textbox, it will pull the number 343 out of that. This can also be accomplished by copying and pasting into a numeric text box also. Does Rad have any built in controls to avoid this? Thanks,

    - Justin 
  2. Evgeniy
    Evgeniy avatar
    11 posts
    Member since:
    Mar 2012

    Posted 10 Aug 2012 Link to this post

    Hello, Justin.
    As I understand, you get 343  instead of GEB34HT3. Rad Numberic Textbox allows to input numbers only. So you can't type any non number symbol. But I suppose you can use RadTextBox or RadMaskedTextBox for your goals.

    All the Best,
    Evgeniy
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Justin
    Justin avatar
    2 posts
    Member since:
    Aug 2012

    Posted 10 Aug 2012 Link to this post

    Hey Evgeniy,

         I appreciate the response. I should have clarified that I only want a quantity in the text box and that's why I went with a numeric text box. If a user accidently scans the wrong thing when focus is on the numeric text box (GEB34HT3) it will remove the letters and input the numbers. 343 is not valid because it is an un-intended value. My form auto saves from that point with the wrong data in the quantity field. I want the textbox to reject anything with non numerical characters and not truncate them. Does the Rad Numeric Textbox support anything like that?

    - Justin
  5. Evgeniy
    Evgeniy avatar
    11 posts
    Member since:
    Mar 2012

    Posted 14 Aug 2012 Link to this post

    The best answer on your question can give you telerik team :)
    But meantime I can suggest to use javascript for your goals

    you can put radnumerictextbox on aspx page
    <telerik:RadNumericTextBox ID="txtNumeric" runat="server" onkeyup="NumericCheck();"></telerik:RadNumericTextBox>

    and write next code on the same page
    <script type="text/javascript">
                function NumericCheck() {
                    var txtNumeric = document.getElementById('<%=txtNumeric.ClientID %>');
                    var v = txtNumeric.value;
     
                    if (!v.match("^[0-9]+$")) {
                        txtNumeric.value = "";
                    }
     
                }
    </script>

    You can use that code as start point to complete your task.
    Hope this helps.

    All the Best,
    Evgeniy 
Back to Top