Hello,
When I try to bind a NumericTextBox or a CurrencyTextBox to a decimal number, I get in the javascritpt console the following error:
"The specified value "2,5" is not a valid number. The value must match to the following regular expression: -?(\d+|\d+\.\d+|\.\d+)([eE][-+]?\d+)?"
The problem seems to be because we use a comma to represent a decimal separator.
I set the culture kendo.culture.es-AR to my layout so the controls should support this.
Can I configure a number format for numeric controls in my proyect to accept a comma for decimal separator?
Thanks.
8 Answers, 1 is accepted
Make sure that you have set matching cultures on the client and server and see how the behavior changes. Check out the following article that illustrates the approach:
With that said, there is a known issue related to similar behavior. You can check it out and observe its status in the link below:
Regards,
Viktor Tachev
Telerik by Progress

Thanks for your answer.
The first link is for ASP.NET MVC, I try to do de same in ASP.NET Core but it doesn't work.
I add this key in my app.config:
<system.web>
<globalization culture="es-AR" uiCulture="es-AR" />
</system.web>
And this code in my Layout
@{
var culture = System.Globalization.CultureInfo.CurrentCulture.ToString();
}
But the value of culture is always "es-419".
Anyway to test that approach I set a hardcoded culture:
<script src="~/lib/kendo-ui/js/cultures/kendo.culture.es-AR.min.js"></script>
<script src="~/lib/kendo-ui/js/messages/kendo.messages.es-AR.min.js"></script>
<script>
kendo.culture("es-AR");
</script>
But I still get the same error when I assign decimals to the NumericTextBox.
The github link leave me to a page not found, so I couldn't see the known issue.
Any Idea how to fix this error?

the NumericTextBox initializes empty and throws the same javascript error: "The specified value "100,5" is not a valid number. The value must match to the following regular expression: -?(\d+|\d+\.\d+|\.\d+)([eE][-+]?\d+)?".
The error you are seeing is observed only in Chrome. The browser flags the value as invalid when comma is used as decimal separator. However, the numeric textbox is working as expected in other browsers.
With that said, the developers are aware of the behavior and will investigate what is causing it.
Regards,
Viktor Tachev
Telerik by Progress

I'm having the same problem as Emmsa. Using decimal/currency for price and fr-CA culture. When I try to post the value, I get « The value '0,45' is invalid. » The same happens in Chrome and IE11.
Viktor do you have any solution to bypass the error? Thank you for your time and support.
If this is the same error when parsing the value, as a current workaround I can suggest setting the type attribute to text:
.HtmlAttributes(
new
{ style =
"width: 100%"
, type =
"text"
})
If this does not resolve the issue, please provide a runnable example reproducing the issue with the -CA culture and I will gladly assist.
Regards,
Stefan
Progress Telerik
Thank you for the example.
After I applied the suggested fix with the text attribute the example was working as expected.
var numericTextBox = html.Kendo().NumericTextBox<
double
>()
.Name(
"Discount"
)
.Enable(
true
)
.Culture(
"da-DK"
)
.HtmlAttributes(
new
{ type =
"text"
})
.Value(4587.25);
Please advise if I missed something.
Regards,
Stefan
Progress Telerik