I am creating crud using C# ASP.Net to update the database(including a salary column type=decimal). In the View, for the input, I have set the type to number and value to the current data, and in the Model and Controller, I've set the data type to decimal. But in the browser, I can not update the fractional part. Ex: if the current salary is 67.25 and I want to change it to 67.15 I receive this error: Enter a valid value, nearest values 66.25, 68.25. Any help is appreciated.
Asked
Active
Viewed 58 times
0
-
Help us reproduce your issue so we can figure out what might be wrong. Maybe provide a minimal reproducible example? – Wyck Dec 10 '21 at 21:30
-
did you try to update it to 66.25? does that work? – Lasse V. Karlsen Dec 10 '21 at 21:36
-
@LasseV.Karlsen Yes. It does accept any number as long as the fractional part stays the same. – Nayereh Rasuli Dec 10 '21 at 21:41
-
1I'm guessing you have a `step=1` attribute on the input (or a similar property value on the control). That error looks like an HTML5 validation error message. Use `step="any"` for floats – D Stanley Dec 10 '21 at 21:48
-
@DStanley I added step="any" and it works, Thank you so much for your help. – Nayereh Rasuli Dec 10 '21 at 21:49
-
Is it a numeric spinner control? The default step is `1` for spinners. Try setting `step` to `0.01` or using a textbox. – D Stanley Dec 10 '21 at 21:51