This is a migrated thread and some comments may be shown as answers.

RadMaskedTextBox delete,space and backspace key behavior

2 Answers 58 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Shane Woodward
Top achievements
Rank 1
Shane Woodward asked on 17 Mar 2011, 03:27 AM
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

Regards.

2 Answers, 1 is accepted

Sort by
0
Alex Fidanov
Telerik team
answered on 17 Mar 2011, 04:38 PM
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
0
john
Top achievements
Rank 1
answered on 22 Dec 2011, 05:17 PM
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
                sender.clear();
            }
        }
Tags
General Discussions
Asked by
Shane Woodward
Top achievements
Rank 1
Answers by
Alex Fidanov
Telerik team
john
Top achievements
Rank 1
Share this question
or