Reputation: 1591
I have a Kendo grid
with InCell
editing mode and decimal
column RATE
.
@(Html.Kendo().Grid(Model.ContractCurrencyClauses)
.Name("ContractCurrencyClauses")
.Columns(columns =>
{
columns.Bound(p => p.RATE).ClientTemplate("...").Width(200);
})
.Editable(editable => editable.Mode(GridEditMode.InCell))
.DataSource(dataSource =>
dataSource.Ajax()
.Model(model =>
{
model.Id(u => u.CONTRACT_ID);
})
.ServerOperation(false)))
The problem was when I submitted the form, I always got null
for RATE
if it is floating point number because of regional settings on my PC, in case of integer it was ok. I solved the issue by adding globalization in Web.config:
<globalization culture="en-US" uiCulture="ru-RU" />
But now en-US
culture affects all kendo widgets, specifically kendo datepicker
. I tried to apply ru-RU
culture or format for datepicker editor template, but it does not work:
@model DateTime?
<script src="~/scripts/kendo/cultures/kendo.culture.ru-ru.min.js"></script>
@(Html.Kendo().DatePickerFor(m => m).Culture("ru-RU").Format("dd.MM.yyyy"))
So, how can I apply en-US
culture for my kendo Grid
only?
Thanks a lot.
Upvotes: 0
Views: 1362
Reputation: 6794
you can use the something like
<script>
kendo.culture("en-GB");
var culture = kendo.culture();
culture.calendar.patterns.d = "dd MMM yyyy"; // short date pattern
culture.calendar.patterns.D = "dd MMM yyyy"; // long date pattern
culture.calendar.patterns.t = "HH:mm"; // short time pattern
culture.calendar.patterns.T = "HH:mm"; // long time pattern
culture.calendar.patterns.g = "dd MMM yyyy HH:mm";
culture.calendar.patterns.G = "dd MMM yyyy HH:mm";
culture.numberFormat.currency.symbol = "$";
</script>
and you can format the number and decimals also.
hope that it will help you
Upvotes: 1