No Textmode property for RadNumericTextBox

2 posts, 0 answers
  1. SUBBU
    SUBBU avatar
    10 posts
    Member since:
    Apr 2012

    Posted 11 Mar 2013 Link to this post

    Hi,
    I need to mask(with bullets) the numbers entered.  But there is no textmode property for RadNumbericTextBox.  I also tried using RadMaskedTextBox, but PromptChar property was not working when textmode is set to Password.
  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 11 Mar 2013 Link to this post

    Hello,

    The RadNumericTextBox does not support the TextMode property. Similarly the PromptChar property of the RadMaskedTextBox does not work if you are setting the TextMode as Password.

    Please have a look into the following code I tried to achieve a similar scenario using the ASP TextBox and JavaScript. The user is allowed to enter only numbers in the textbox and on entering other invalid characters the textbox border color changes to red.

    ASPX:
    <asp:TextBox ID="textBox" runat="server" MaxLength="5" TextMode="Password"
             onKeyPress="return checkInput(event);" onKeyDown="return checkInput(event);">
    </asp:TextBox>

    JavaScript:
    <script type="text/javascript">
        function checkInput(event) {
            var inp = String.fromCharCode(event.keyCode);
            if ((event.keyCode >= 48 && event.keyCode <= 57) || (event.keyCode == 8)) {
                document.getElementById("<%= textBox.ClientID %>").style.border = "1px solid #050409";
                return true;
            }
            else {
                document.getElementById("<%= textBox.ClientID %>").style.border = "1px solid #FF2424";
                return false;
            }
        }
    </script>

    Thanks,
    Princy.
Back to Top