Calendar culture in Grid ASP Core

1 Answer 52 Views
Calendar Grid
Jacek
Top achievements
Rank 2
Iron
Iron
Iron
Jacek asked on 21 May 2023, 06:46 PM

I'm having problem setting culture in a calendar called from Grid.
Below is my sample:

<script>
     kendo.culture("@Model.userSetting.culture");
</script>

....

       @(Html.Kendo().Grid<MyProject.Model.ModelName>()
                        .Name("gTasks")
                        .Columns(columns =>
                        {
                            columns.Bound(p => p.Id).Width(100).Visible(false);
                            columns.Bound(p => p.taskID).Width(100).Visible(false);
                            columns.Bound(p => p.Start).Format("{0:" + Model.userSetting.dateFormat + "}").Sortable(true).Width(100).Title("Start").EditorTemplateName("GridCalendarTemplate");
                            columns.Bound(p => p.End).Format("{0:" + Model.userSetting.dateFormat + "}").Sortable(true).Width(100).Title("End").EditorTemplateName("GridCalendarTemplate");
                         })
)

....



   

 

In Views/Shared/EditorTemplates/GridCalendarTemplate.cshtml


@model DateTime?
@{
    var culture = Context.Session.GetString("culture");

}
<script>
    kendo.culture("@culture");
</script>
@(Html.Kendo().DatePickerFor(m => m)
    .Culture("@culture")
    .HtmlAttributes(new { title = Html.ViewContext.ViewData.TemplateInfo.GetFullHtmlFieldName("") }))
Unfortunately, the calendar format does not accept culture "pl-PL"

1 Answer, 1 is accepted

Sort by
0
Jacek
Top achievements
Rank 2
Iron
Iron
Iron
answered on 21 May 2023, 10:20 PM

I solved the problem.

It was my simple mistake to add <script src="https://kendo.cdn.telerik.com/2023.1.117/js/cultures/kendo.culture.pl-PL.min.js"></script >

Mihaela
Telerik team
commented on 24 May 2023, 01:49 PM

Thank you for confirming that you managed to resolve the issue with the missing culture.

If any related questions arise, feel free to share them.

Best,

Mihaela

Tags
Calendar Grid
Asked by
Jacek
Top achievements
Rank 2
Iron
Iron
Iron
Answers by
Jacek
Top achievements
Rank 2
Iron
Iron
Iron
Share this question
or