Numeric copy/paste problem(comma/point)

3 posts, 1 answers
  1. Dirk
    Dirk avatar
    43 posts
    Member since:
    May 2011

    Posted 21 Sep 2011 Link to this post

    In Germany we use a comma to separate a number: 12,45 (not 12.45).
    If I copy and paste a number with a comma in a the RadMaskedNumericInput control, the pasting fails: I get 1245 (without comma).
    If I paste 12.45 it works and I get 12,45, but this doesn't solve my problem in Germany.

    If I use the RadMaskedTextBox (numeric style) I don't have this problem, but the MaskedTextbox hasn't the possiblities (like Watermarktext) like theRadMaskedNumericInput control.

    Do you have a solution, how I can excahnge the comma with a point on the fly so that the pasting succeed?

    Regards
    Dirk
  2. Answer
    Tina Stancheva
    Admin
    Tina Stancheva avatar
    3298 posts

    Posted 26 Sep 2011 Link to this post

    Hi Dirk,

    Thank you for reporting this issue - I logged it in our PITS, where you can track its progress. Can you please tell us how would you expect the control to behave? Basically what we can do is allow the control to paste floating-point numbers depending on its culture. For example if you paste a number with comma separator in a MaskedNumericInput control with culture where the decimal separator is a comma, the value will be properly pasted. However, pasting a number with point separator in a MaskedNumericInput control with culture where the decimal separator is a comma won't paste the number as a floating-point number. And vice versa - pasting a floating-point number with comma separator in a MaskedInput control with culture where the point character is the decimal separator, won't work

    Is this the expected behavior of the control for you? Your feedback on the matter will be highly appreciated.

    In the meantime you can create a custom control deriving from the MaskedNumericInput control to change the default paste behavior of the control. I attached a sample project demonstrating this approach. Please have a look at it and let us know if it works for you.

    Regards,
    Tina Stancheva
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  3. DevCraft banner
  4. Dirk
    Dirk avatar
    43 posts
    Member since:
    May 2011

    Posted 29 Sep 2011 Link to this post

    Thank you Tina,
    your workarouand is working.

    And yes, copy and paste should only work within the same culture.
    'Cross culture' copy and paste is not necessary. And if it is needed it is still posible to use your workaraound.
    In our Silverlight application we want to be able to copy and paste numbers from Excel to the RadInputNumericControl (Culture de-DE)

    Regards
    Dirk
    PS: I have an other problem :
    http://www.telerik.com/community/forums/silverlight/maskedinput/wrong-behaviour-with-mask-9-5.aspx
Back to Top