I have some prices to display and edit in a Kendo UI Grid.
Prices ned to be shown (and edited) in nl-NL format. Prices are in double format.
The grid show it like: € 12,34. With a comma as separator. This is the correct format.
The I click on a cell to edit the price the edit cell display 12.34
- no currency symbol, which is not the main issue but would be great if this is also possible)
- displays with a point as decimal separator. When I change the value to 12.35 (with the same point separator as the edit box shows) it is stored as 1235.
- I need to edit the point as well and make it 12,35 (with the comma as separator). This behaviour is right btw, because we always edit with the comma as separator.
But the question is:
Why is the number displayed with a point as separator in the first place when I click on a cell. I need it there to display with the comma as a separator.
My code looks like the following:
ViewModel
[DisplayFormat(DataFormatString = "{0:C}", ApplyFormatInEditMode = true)]
[Display(Name = "Price")]
public double? price { get; set; }
.cshtml
columns.Bound(c => c.price).Filterable(false).Width(100);
@(Html.Kendo().Grid<
PriceViewModel
>()
.Name("grid").AutoBind(false)
.Columns(columns =>
{
columns.Bound(c => c.Id).Hidden();
...
columns.Bound(c => c.price).Filterable(false).Width(100);
...
})
...
.Editable(e =>
{
e.Mode(GridEditMode.InCell);
e.DisplayDeleteConfirmation(false);
})
...
.DataSource(dataSource => dataSource
.Ajax()
.Batch(true)
.ServerOperation(false)
.PageSize(12)
.Model(model => model.Id(c => c.Id))
.Read(read => read.Action("Read", "MaterialByClass").Data("getClassname"))
.Model(model =>
{
model.Id(p => p.Id);
model.Field(p => p.code).Editable(false);
...
}
)
.Update("Update", "MaterialByClass")
.Destroy("Delete", "MaterialByClass")
)
)
@section scripts
{
@Scripts.Render("~/bundles/jquery-cookie")
<
script
type
=
"text/javascript"
>
$(document).ready(function () {
kendo.culture("nl-NL");
...
});
</
script
>
}
Web.Config
<
system.web
>
...
<
globalization
culture
=
"nl-NL"
uiCulture
=
"nl"
enableClientBasedCulture
=
"true"
/>
...
</
system.web
>