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

Multiple Masks?

2 Answers 274 Views
MaskedTextBox
This is a migrated thread and some comments may be shown as answers.
Marc Simkin
Top achievements
Rank 2
Iron
Veteran
Iron
Marc Simkin asked on 18 Feb 2021, 06:23 PM

I am debating if I want to use the MaskedTextBox instead of the TextBox.  If I use the MaskedTextBox, I would need to give it a collection of masks.  For example

  • ISBN-13: 000-0-00000-000-0
  • ISBN-10 0-00000-000-0
  • ASIN: AAAAAAAAAA

Thanks

-marc

2 Answers, 1 is accepted

Sort by
0
Accepted
Marin Bratanov
Telerik team
answered on 19 Feb 2021, 12:18 PM

Hi Marc,

I am afraid that such logic is impossible for a masked textbox component. The masks can have too many differences in the input they must allow and it is impossible for the component to know when and how to switch between them.

You could perhaps make the first three zeroes optional for ISBN 10 (see the "9" rule), or see about masking it with literals, and combine both ISBN settings into one, but the other number is decidedly different.

Perhaps you could have another setting (dropdown or radio buttons) that let the user choose the type of number they want to input and that toggles the mask into one of the options, or even switches out entire component instances so you can have varying settings between them.

 

Regards,
Marin Bratanov
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

0
Marc Simkin
Top achievements
Rank 2
Iron
Veteran
Iron
answered on 25 Feb 2021, 10:40 AM
Understood and closed.
Tags
MaskedTextBox
Asked by
Marc Simkin
Top achievements
Rank 2
Iron
Veteran
Iron
Answers by
Marin Bratanov
Telerik team
Marc Simkin
Top achievements
Rank 2
Iron
Veteran
Iron
Share this question
or