Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
25
Apply decimal mask to a textbox
posted

Hi, i want to apply a decimal mask to a textbox like Mask="nnn.nn" and when the user provides only 2 digits before decimal seperator to ignore the remaing spaces for chars before seperator.

e.g if mask is "nnn.nn" and i type 45 I want the value to be 45.00 without validation errors.

Any ideas?

  • 355
    Verified Answer
    Offline posted

    I would handle something like this with a keydown or text changed event handler and check to see if it is white space then remove the white space or quickly update the text to make it match the validation rule.