Decimal Seperator on Grid Cell

3 posts, 0 answers
  1. Kursad Nebi
    Kursad Nebi avatar
    2 posts
    Member since:
    Mar 2016

    Posted 29 Mar 2016 Link to this post

    Decimal separator changes comma to dot when focused to update cell. see in attached images.

     

    Notes:

    GridEditMode.InCell

    ------------

    columns.Bound(p => p.ALIS_FIYATI).Width(220).Format("{0:n2}"); 

    -------------

        <script src="@Url.Content("~/Scripts/kendo/cultures/kendo.culture.tr-TR.min.js")"></script>
        <script>
            kendo.culture("tr-TR");
        </script>

     

  2. Dimiter Topalov
    Admin
    Dimiter Topalov avatar
    1266 posts

    Posted 01 Apr 2016 Link to this post

    Hello Kursad,

    The described undesired behavior is caused by the fact that there is no default Editor Template set for the corresponding data type, and therefore the value is opened for editing in a regular textbox. The default JavaScript decimal separator is a dot ('.').

    To apply the custom Kendo Culture settings while editing, you have to create a default Editor Template for the decimal (or double) type, so that the corresponding values will be opened in a Kendo UI NumericTextBox and the correct culture settings will be applied. For example:

    // Grid Configuration
    ...
    columns.Bound(p => p.ALIS_FIYATI).Width(220).Format("{0:n2}").EditorTemplateName("Decimal");
    ...
     
    // Decimal.cshtml file in Views/Shared/EditorTemplates
    @model decimal
     
    @(Html.Kendo().NumericTextBoxFor(m => m)
          .HtmlAttributes(new { style = "width:100%" })
    )

    You can find more information about Editor Templates in the following section of our documentation:

    http://docs.telerik.com/kendo-ui/aspnet-mvc/helpers/grid/editor-templates#editor-templates

    I hope this helps.

    Regards,
    Dimiter Topalov
    Telerik
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  3. Kursad Nebi
    Kursad Nebi avatar
    2 posts
    Member since:
    Mar 2016

    Posted 01 Apr 2016 in reply to Dimiter Topalov Link to this post

    Great!

    Thank you.

Back to Top