NumericTextBox<decimal>() and ms sql server 2008

1 Answer 90 Views
NumericTextBox
Вадим
Top achievements
Rank 1
Iron
Iron
Вадим asked on 13 Feb 2022, 10:30 AM

<div class="form-group">
                        <label asp-for="Summ">Стоимость от</label>
                        @(Html.Kendo().NumericTextBox<decimal>()
                            .Name("Summ")
                            .Min(0)
                            .Value(Model.Summ)
                            .HtmlAttributes(new { style = "width: 100%" })
                        )
                    </div>

public class ServiceViewModel
    {
        ......
        public decimal Summ { set; get; }.....
    }

var supportedCultures = new[] { new CultureInfo("ru-RU") };

            app.UseRequestLocalization(new RequestLocalizationOptions
            {
                DefaultRequestCulture = new RequestCulture("ru-RU"),
                SupportedCultures = supportedCultures,
                SupportedUICultures = supportedCultures
            });

<script src="~/lib/kendo/js/cultures/kendo.culture.ru-RU.min.js"></script>

the database contains a value, but does not display it correctly.And also, when saving the form, it does not take a value in the model, therefore, in the controller, the value is 0.How to fix it all? 

1 Answer, 1 is accepted

Sort by
1
Mihaela
Telerik team
answered on 16 Feb 2022, 05:16 PM

Hi Вадим,

According to the provided screenshot, the decimal separator of the NumericTextBox is "." instead of ",". Would you please ensure that the Russian culture is set on the client-side as it is explained in this article?

For example:

//"_Layout.cshtml"
<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>@ViewData["Title"] - Project</title>

   <!-- client-side resources-->
    <script src="https://cdn.kendostatic.com/<kendo version>/js/cultures/kendo.culture.ru-RU.min.js"></script>
    <script>
        kendo.culture("ru-RU");
    </script>
</head>

It is important to set the client-side culture before initializing any helpers that rely on it.

Also, I am attaching a runnable sample for your reference.

 

Regards, Mihaela Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Вадим
Top achievements
Rank 1
Iron
Iron
commented on 16 Feb 2022, 06:23 PM

Thank you. Didn't set in script: 

 kendo.culture("ru-RU");
Tags
NumericTextBox
Asked by
Вадим
Top achievements
Rank 1
Iron
Iron
Answers by
Mihaela
Telerik team
Share this question
or