Databinding decimal problem

2 posts, 0 answers
  1. StevenDale
    StevenDale avatar
    100 posts
    Member since:
    Apr 2007

    Posted 31 Mar 2011 Link to this post

    I have several places in my application where I bind decimals to textbox controls. I have UpdateSourceTrigger=PropertyChanged so that my buttons attached to commands enable when a valid value is entered so the user does not have to click out of the textbox to enable the save button.

    Problem 1: Lets say you have the value 24.05 in the text. Now place the cursor between the 4 and the decimal place holder. Backspace 2 times and type in the number 8. Instead of 8.05 you get 80.05. Our users are used to being able to type without looking and expect what they type to be correct.

    Problem 2: Type in the value .234. Instead of .234 you get 0.342.

    I know I could solve the problem by changing UpdateSourceTrigger=PropertyChanged to UpdateSourceTrigger=LostFocus but this will cause the user to have to tab out of the control or click inside of another control to enable the save button which defeats the purpose of Commanding.

    Can I use the MaskedInput Control to fix this? I tried it with the example from your Sample Project under Masked TextBox -> NumericMask  labeled: "5 Digits after the decimal point" but that does not handle problem #1. If you don't have a control to handle this, do you know of a workaround for this?

  2. Alex Fidanov
    Alex Fidanov avatar
    637 posts

    Posted 04 Apr 2011 Link to this post

    Hi Billy Jacobs,

    This is a known issue for the RadMaskedTextBox, however, the same scenario is resovled with the RadMaskedNumericInput. I am not sure which sample you tried for the numeric input control, but there is none with the description you mentioned. Please try using this one.

    Regarding problem 2, you can also use the masked numeric input. With the current version, you would have to enter 0.234 to get this behavior, however as of today's (or next week's) internal build, it would be possible to enter only ".234".

    Best wishes,
    Alex Fidanov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Back to Top