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

Simple question, how do you clear a MaskedInput control?

2 Answers 359 Views
MaskedInput (Numeric, DateTime, Text, Currency)
This is a migrated thread and some comments may be shown as answers.
Rod
Top achievements
Rank 1
Rod asked on 04 Oct 2012, 02:55 PM
Very simple question, but I'm not sure how to do it with the Telerik MaskedInput controls.  How do you clear the control?  For example, I'm using a RadMaskedTextInput to collect social security numbers.  The Mask property is set to "d3-d2-d4".  If I want to clear the control do I set the Value property to "000000000"?  Or do I set the Text property to "___-__-____"?  Or is there some other property that I should use instead?  I've tried looking for a Clear() method of the control, but there doesn't appear to be one, unless I've missed it.

I'm using VS 2010 Premium, .NET 4.0, and 2011 Q2 versions of the Telerik controls.

2 Answers, 1 is accepted

Sort by
0
Accepted
Pavel R. Pavlov
Telerik team
answered on 08 Oct 2012, 02:55 PM
Hello Rod,

Thank you for the detailed information about your issue.

RadMaskedTextInput works with string value, so if you want to clear it, you have to set its Value to Null (as in the sample project). You can find more information about the Value and Text properties of the control in our documentation.

The default empty Value is zero only in our MaskedNumericInput and MaskedCurrencyInput controls. In case you want to display zeros instead of an empty string in a RadMaskedTextInput, you have to set the Value to "000000000" manually. This can be done by handling the ValueChanged event and replacing the Null value with the nulls.

Also, clearing the value is implemented out-of-the-box in our clear button (through a Command called ClearCommand) that is displayed in the right side of the RadMaskedTextInput. This is why you can use our button or create another button to execute the ClearCommand.

In this article you can find more information about the RadMaskedInput controls. Let me know if it helps or if we can further assist you.

Kind regards,
Pavel R. Pavlov
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Rod
Top achievements
Rank 1
answered on 08 Oct 2012, 05:20 PM
Thank you, your reply answers my question.  I know that the Telerik controls implement a clear button out of the box, and I've shown it to my users.  Some users get it; others don't, thus sometimes I have to do more work.
Tags
MaskedInput (Numeric, DateTime, Text, Currency)
Asked by
Rod
Top achievements
Rank 1
Answers by
Pavel R. Pavlov
Telerik team
Rod
Top achievements
Rank 1
Share this question
or