The RadzenNumeric control uses a string parameter as the step size. If I try the samples in my machine, they don't work properly as the Step parameter has a dot but in my machine it expects a comma as decimal separator (es-ES culture). Why the Step parameter is not of type "TItem" ?
Also, it seems that the control size depends on the Step, Max an Min parameters. However, it does not work for my culture. If I specify a Step="0,001", Min=0 and Max=40 the control does not display all the digits. I need to specify a Step="0.001" for it to make the control wide enough. However, as my culture is es-ES, it increments the value in steps of one instead of 0.001 because of the problem described in the first paragraph.
And last but not least, that automatic sizing can be useful in a lot of scenarios, but it would be great if there is a parameter to turn it off in order to have consistency in width sizes between different RadzenNumeric components.
I'm not sure about automatic sizing - can you elaborate? You do not have to specify width for the Numeric component or you can specify width: 100% if you want the component to be sized according to parent: https://blazor.radzen.com/numeric
I tried using the Step with comma because using it with a dot didn't work for me. I'm fine setting the literal values with a dot if you change the type to TValue.
Hello!
How to prevent showing comma other than server's current culture in numeric updown?
Users can make input errors without knowing which separator is required, for example by entering:
The component converts this value without a separator:
Also, I would like such input to the component to be impossible:
I'll try to demonstrate my workaround.
So, we need to prevent input errors associated with the decimal delimeter. Suppose the server is in an area where the separator is a comma. We need to handle the dot input and cancel it.
Write the javascript function:
function PreventDotInput () {
$ ('.ui-spinner-input').on('keydown', function (e) {
if (e.key === '.') {
e.preventDefault();
}
});
};
Save it to the ElementsUtil.js file in the wwwroot/js folder
Include a script in _Hosts.cshtml
<script src = "/js/ElementsUtil.js" type = "text/javascript"></script>
For the RadzenNumeric component that needs to set this behavior, write:
<RadzenNumeric onclick = "PreventDotInput()">
That's it, now when receiving focus, this component will not output pressing dot.