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

RadMaskedEditBox simple decimal

3 Answers 788 Views
MaskedEditBox
This is a migrated thread and some comments may be shown as answers.
Jan Pfeffer
Top achievements
Rank 1
Jan Pfeffer asked on 30 Aug 2011, 01:37 PM
Hey at Telerik

I would like to know how i can set the RadMaskedEditBox to accept only a decimal number.

I need the RadMaskedEditBox for coordinates and cannot limit the box to a specific number og digits before the seperator or after.

The closest i can get is by setting the MaskType of the RadMaskedEditBox to 'Numeric' and the Mask to 'n'.

As i see it 'n' and 'n2' gives the same result. isn't 'n' supposed to not limit the input.

Sincerly

Jan

3 Answers, 1 is accepted

Sort by
0
Stefan
Telerik team
answered on 02 Sep 2011, 12:39 PM
Hello Jan,

Thank you for contacting us.

The "n" mask by default requires two zeroes after the place holder, so yes "n" and "n2" does the same thing. For your scenario, the simplest mask that you can use in order to limit the number of digits before and after the place holder is the Standard mask:

radMaskedEditBox1.MaskType = MaskType.Standard;
radMaskedEditBox1.Mask = "##.####";

The provided code limits to 2 digits before the place holder and 4 digits after it.

I hope this helps. If you need further assistance, I will be glad to help.
 
Regards,
Stefan
the Telerik team

Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

0
Jan Pfeffer
Top achievements
Rank 1
answered on 05 Sep 2011, 07:18 AM
Hello Stefan

What i need is not to limit the number of digits before or after the place holder.

Compare it to a RadNumericTextBox  that has holds the datatype decimal from the ASP.NET control collection.

Examples of values i must be able to support.
1.7632632
837.87
3346.98372
23.91237
99782.9821
1221.2312
etc.

Sincerly

Jan
0
Accepted
Stefan
Telerik team
answered on 07 Sep 2011, 06:25 PM
Hi Jan,

Thank you for writing me back.

Currently, I am not able to provide you with a control that validates decimal number out of the box. However, this can be easily implemented with simple text box control. Please refer to the attached project, where you can observe such an implementation.

Alternatively, you can use RadSpinEditor control, which supports decimal numbers. The only limitation is that you have to predefine the DecimalPlaces and if the user does not fill in enough decimal places the rest is filled with zeroes.

Furthermore, we will consider improving the masks that RadMaskedEditBox provides, in order to achieve the desired functionality.

I hope that you find this information useful. If you have any other questions, do not hesitate to contact us.

Best wishes,
Stefan
the Telerik team

Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

Tags
MaskedEditBox
Asked by
Jan Pfeffer
Top achievements
Rank 1
Answers by
Stefan
Telerik team
Jan Pfeffer
Top achievements
Rank 1
Share this question
or