RadMaskedNumericInput not respecting FormatString?

6 posts, 0 answers
  1. Adam
    Adam avatar
    70 posts
    Member since:
    Jun 2008

    Posted 02 Nov 2012 Link to this post


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

    Posted 05 Nov 2012 Link to this post

    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.

  3. DevCraft banner
  4. Sintayehu
    Sintayehu avatar
    67 posts
    Member since:
    Jan 2013

    Posted 14 Jan 2014 Link to this post

    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.

  5. Petar Mladenov
    Admin
    Petar Mladenov avatar
    2891 posts

    Posted 15 Jan 2014 Link to this post

    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 >>
  6. Sintayehu
    Sintayehu avatar
    67 posts
    Member since:
    Jan 2013

    Posted 15 Jan 2014 Link to this post

    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?
  7. Petar Mladenov
    Admin
    Petar Mladenov avatar
    2891 posts

    Posted 20 Jan 2014 Link to this post

    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 >>
Back to Top
DevCraft banner