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

RadMaskedNumericInput not respecting FormatString?

7 Answers 549 Views
MaskedInput (Numeric, DateTime, Text, Currency)
This is a migrated thread and some comments may be shown as answers.
Adam
Top achievements
Rank 1
Adam asked on 02 Nov 2012, 03:24 PM

Hi everyone,

The Common MaskedInput documentation has the following statement:

The 'no-mask' functionality will remove the restrictions usually applied by the Mask property on the type and the number of input characters in each of the controls. Still you can set the FormatString property to control the input in the RadMaskedInput controls when they don't specify a Mask.

So far, I have not been able to get this to work.  For instance, if I set the Mask to empty and set the FormatString to something like "########.##########" I do not seem to be able to enter a decimal number at all, meaning there is no capability to type a decimal separator.  If I were to set a Mask, something like "#8.10", I still get a lot of zero autofilling even though those options are turned off.

Let me know if you need more detail,

Thanks!
Adam.g

7 Answers, 1 is accepted

Sort by
0
Pavel R. Pavlov
Telerik team
answered on 05 Nov 2012, 01:16 PM
Hello Adam,

We have defined mask tokens that can be used to restrict the user input in our MaskedInput control suite. These tokens are designed to describe the Mask of the controls. On the other hand the FormatString property is used for further restriction of the user input. The FormatString property allows you to use standard numeric format strings and custom numeric format strings to further restrict the numeric input.

For further information, please take a look at this article and let me know if you have any other questions

Kind regards,
Pavel R. Pavlov
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Sintayehu
Top achievements
Rank 1
answered on 14 Jan 2014, 09:40 PM
Hello,

I am also using the numeric masked control with No Mask.

My requirement is " as user enters data I want the precision digits to be optional and not be populated by zeros".

Currently I have a standard format string of "N2" which always adds 2 zeros at the end.

example:

Entering 12345  reads like 12345.00

So I am trying to provide a custom Format string specifier to the MaskedInput FormatString property as per link below. To make the two zeros be optional

 http://msdn.microsoft.com/en-us/library/0c899ak8.aspx#SpecifierD

I tried:

FormatString="{}{0:#####.##}"

without luck.

I am on the latest 2013 Q3 version.

0
Petar Mladenov
Telerik team
answered on 15 Jan 2014, 07:37 AM
Hello Sintayehu,

To achieve optional precision symbols is it ok for you to type the decimal separator manually. If yes, you can use RadMaskedTextInput with Mask = "" (no-mask), type the decimal separator when needed and you can also bind the Value (which is of type string) to double / double? property from our viewmodel with converter. In the converter methods you can parse the string you have typed to a double. Let us know if this is option for you or not.

Regards,
Petar Mladenov
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for SILVERLIGHT.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
0
Sintayehu
Top achievements
Rank 1
answered on 15 Jan 2014, 03:49 PM
We have customized, styled and implemented the RadMaskedNumericInput in our product and would really be awesome if we could just make change to it than introduce another control at this point. Not to mention the TextInput idea introduces other problems like how to restrict users to entering numbers and the decimal point.

Are you saying that the FormatString property in the RadMaskedNumericInput control does not take in custom formatting as indicated?
0
Petar Mladenov
Telerik team
answered on 20 Jan 2014, 07:56 AM
Hi Sintayehu,

Visually, all MaskedInput controls are equal - the Style that is applied to them is actually targeting RadMaskedInputBase which is the base class for the 4 masked input controls. So this shouldn't be a showstopper for you. In order to restrict only digits input int he TextInput is to use #-symbols in the Mask but this way you will set the exact max number of digits user can type.
As for the FormatString, if you are able to use a particular custom FormatString in TextBox whose Value is bound to double (and you set this custom StringFormat on the binding) this should also work in no-masked NumericInput.  If it does not work in the MaskedInput but it works in TextBox we can log this as a bug in our system and consider fixing it in future releases.

Regards,
Petar Mladenov
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for SILVERLIGHT.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
0
Alexandre
Top achievements
Rank 1
answered on 09 Jan 2018, 02:15 PM

Hello

we have the same problem here

we are using radMaskedNumericInput in our application and we can sometime need a big precision like123.12345678 but we don't want so much 0 to apear when not needed.

So we need to be abble to type 999999999.999999999

When typing 999 we do not want to have this : 999.000000000 but this : 999

is this possible in last telerik version to do this ?

 

0
Petar Mladenov
Telerik team
answered on 12 Jan 2018, 08:59 AM
Hello Alexandre,

First let me make a note that when you edit such long doubles, mind the double's precision and the fact that you can expect some rounded or out of precision numbers. For example 999999.99999999 might be rounded to 1000000.000000. This is because of some "parse" / "format" / "ToString" methods which happen from number to text and vice versa. Or also, additional random digits might be appended after loosing precision (this also comes from formatting via the WPF framework methods).

Generally if you need higher precision you can use RadMaskedCurrencyInput instead of RadMaskedNumericInput, their Value properties are of type decimal? and double? respectively.
Decimal has higher precision than double.

We have the following SDK demo which implements a dynamic number of digits after the decimal point. Please check it out and let us know if it fits well in your requirements:

MaskedInput DynamicFormatString SDK

Regards,
Petar Mladenov
Progress Telerik
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
MaskedInput (Numeric, DateTime, Text, Currency)
Asked by
Adam
Top achievements
Rank 1
Answers by
Pavel R. Pavlov
Telerik team
Sintayehu
Top achievements
Rank 1
Petar Mladenov
Telerik team
Alexandre
Top achievements
Rank 1
Share this question
or