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

Apply culture formatting in grid

1 Answer 32 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Frans
Top achievements
Rank 1
Veteran
Iron
Frans asked on 16 Mar 2021, 10:03 AM

Hi,

I would like to format date columns and decimal number columns in the correct format, according to the logged in users' culture.
I found examples / code snippets of that, but those didnt work. Maybe because a clientside culture variable was needed but not present or so. or maybe because the formats were not supported I dont know.

Anyway, how can I achieve culture formatting in the grid ?

Preferably in a simple serverside way. And also preferably not on application level (by setting application culture), but controller level, or just custom formatting myself serverside, without setting the culture on application level.

For example, I live in the Netherlands, where the date format is: dd-MM-yyyy, and the decimal number format N2, or e.g.: 2.500.000,95

I have the culture of the logged in user both serverside as clientside in a variable.

 

Martin

 

1 Answer, 1 is accepted

Sort by
0
Tsvetomir
Telerik team
answered on 19 Mar 2021, 06:40 AM

Hi Martin,

When the application should run culture-specific formats, then you should set the culture of the client-side as shown in the following resources:

After the culture scripts are loaded and the option is set up, you could apply custom formatting for some of the columns:

 

.Format("{0: n2}")

 

This way, the Kendo UI Grid will apply a number format with two decimals after the decimal separator and it will be culture-specific.

Give this suggestion a try and let me know how it works out for you.

 

Regards,
Tsvetomir
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Tags
Grid
Asked by
Frans
Top achievements
Rank 1
Veteran
Iron
Answers by
Tsvetomir
Telerik team
Share this question
or