RadMaskedTextBox delete,space and backspace key behavior

3 posts, 0 answers
  1. Shane Woodward
    Shane Woodward avatar
    13 posts
    Member since:
    Jan 2010

    Posted 16 Mar 2011 Link to this post

    Is it possible to allow the delete, backspace and space keys pressed to make the contents of a numeric masked textbox value back to null.

    Here my code:

                <telerik:RadMaskedTextBox Width="100" x:Name="txtGrossPay" Grid.Row="24" Margin="165,2,478,2" MaskType="Numeric" Mask="n2" VerticalAlignment="Center" ValueChanging="balances_ValueChanging" SelectionOnFocus="SelectAll" EmptyContent=""></telerik:RadMaskedTextBox>

    I want the user to press delete, backspace or space to blank out (null) the value again, instead of 0-ing the value to $0.00

  2. Alex Fidanov
    Alex Fidanov avatar
    637 posts

    Posted 17 Mar 2011 Link to this post

    Hello Shane Woodward,

    The RadMaskedTextBox does not support nullable values so you would not be able to delete the value completely. It would take its default value, which is 0 for numeric values. You could try out our new masked input suite of controls, that we released with Q1 2011. They do support nullable values.

    All the best,
    Alex Fidanov
    the Telerik team
  3. john
    john avatar
    5 posts
    Member since:
    May 2009

    Posted 22 Dec 2011 Link to this post

    I found this thread when I was trying to solve the problem of selecting all and hitting backspace did not clear the contents of the mask and the mask contents just reformed; here is the solution to that problem:

    function txtGrossPay_OnValueChanged(sender, EventArgs) {
                if (!EventArgs.get_newValue() || EventArgs.get_newValue().length == 0) { //If they are trying to empty the text box then reset it to default
Back to Top