This is a migrated thread and some comments may be shown as answers.

Decimal separator InCell editing

1 Answer 271 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Iwan van Ee
Top achievements
Rank 1
Iwan van Ee asked on 14 Nov 2016, 10:47 AM

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>

1 Answer, 1 is accepted

Sort by
0
Konstantin Dikov
Telerik team
answered on 16 Nov 2016, 07:00 AM
Hello Iwan,

Can you please ensure that you are adding the nl-NL script file:
<script src="@Url.Content("~/Scripts/cultures/kendo.culture.nl-NL.min.js")"></script>

You can refer to the following help article for detailed information on globalization:
Hope this helps.


Regards,
Konstantin Dikov
Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
Grid
Asked by
Iwan van Ee
Top achievements
Rank 1
Answers by
Konstantin Dikov
Telerik team
Share this question
or