Simple question, how do you clear a MaskedInput control?

3 posts, 1 answers
  1. Rod
    Rod avatar
    71 posts
    Member since:
    Jan 2011

    Posted 04 Oct 2012 Link to this post

    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. Answer
    Pavel R. Pavlov
    Admin
    Pavel R. Pavlov avatar
    1182 posts

    Posted 08 Oct 2012 Link to this post

    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.

  3. UI for WPF is Visual Studio 2017 Ready
  4. Rod
    Rod avatar
    71 posts
    Member since:
    Jan 2011

    Posted 08 Oct 2012 Link to this post

    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.
Back to Top