RadMaskedTextInput

1 Answer 94 Views
MaskedInput (Numeric, DateTime, Text, Currency)
Chris
Top achievements
Rank 1
Chris asked on 03 Jul 2023, 04:13 PM

Hello,

 

I have a RadMaskedTextInput that I'm using for a phone number.

 

If I clear the form, and set the txtDriverNumber (that's the name of the field) using txtDriverNumber.Text = "" (and I also tried string.Empty) it looks like it clears the value correctly.


However, when the textbox gets focus again, it puts back in the last entered data.  I don't want it to do that, is there something I can do to make sure it doesn't remember previous values?

1 Answer, 1 is accepted

Sort by
0
Stenly
Telerik team
answered on 06 Jul 2023, 07:58 AM

Hello Chris,

To clear the content of the RadMaskedTextInput control, utilize the Value property rather than the Text one.

The following code snippet shows this suggestion's implementation:

//Value of RadMaskedTextInput is cleared on a button's Click event
private void Button_Click(object sender, RoutedEventArgs e)
{
    this.txtDriverNumber.Value = string.Empty;
}

When the Click event occurs, the following result is present:

With this being said, could you give this suggestion a try?

Regards,
Stenly
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Chris
Top achievements
Rank 1
commented on 06 Jul 2023, 08:21 PM

Great, thank you so much.  That works.

 

Strange that the .Text property DOES clear the field but only until it gets focus again, though.

Tags
MaskedInput (Numeric, DateTime, Text, Currency)
Asked by
Chris
Top achievements
Rank 1
Answers by
Stenly
Telerik team
Share this question
or