Editing Kendo Grid Date

I have been studying this for many days without much luck. I went in several ways, but I can not find a solution that works. Any help would be greatly appreciated.

I have a Kendo MVC grid connected to CRUD

@(Html.Kendo().Grid<Games.Models.Game>() .Name("Grid") .Columns(columns => { columns.Bound(p => p.GameName).Width(100); columns.Bound(p => p.Publisher).Width(75); columns.Bound(p => p.MaxPlayers).Width(75); columns.Bound(p => p.DateAdded).Width(100).Format("{0:MM/dd/yyyy}"); 

When I try to change the DateAdded field, it changes the date from my beautifully formatted date 05/01/2003 to May 1, 17:00:00 CDT 2003 and gives an error when trying to update the data (any input is converted to Year, Month, Time, TimeZone year).

The grid returns "The DateAdded field must be a date error."

I tried using the editor template using Kendo Date Picker, but the data is not updated in my model.

 columns.Bound(p => p.DateAdded).Width(100).Format("{0:MM/dd/yyyy}").EditorTemplateName("DateTime"); 

Editor Template:

 @(Html.Kendo().DatePicker() .Name("datepicker") .Format("M/d/yyyy") ) 

Any idea on what I'm doing wrong? I can skip using date picker if I can update the date in the string, but I cannot get any method to work.

+4
source share
1 answer

The datetime is checked against the culture indicated on the client (kendo culture). Keep in mind that validation and editor format are two different things. You must change the culture to the one used as the date / month format. A similar case is here .

More information about kendo culture and how to change it can be found in the documentation .

+1
source

Source: https://habr.com/ru/post/1469102/


All Articles