I have a kendo grid with inline editing enabled. One of the field is a datetime field and it is configured to be non-editable. After a update(or delete) action is triggered, the millisecond part of the value of the field is lost in the controller. Is there anyway to avoid it?
2 Answers, 1 is accepted
0
Stefan
Telerik team
answered on 29 Nov 2017, 12:25 PM
Hello, Zhang,
In general, the milliseconds part should be sent to the Controller as well.
In some cases due to C# specifics, the milliseconds part may seem as lost:
I have found the root cause. But thanks for the reply anyway.
The millisecond part is lost at the client side (View), not at the server side (Controller). DateTimePicker is not used at all.
When a update/delete command is triggered at the view, the script at kendo.aspnetmvc.min.js will try to serialize the object for posting the data back to the server. The javascript code uses the 'G' format to convert the datetime field to a string and this causes the loss of the millisecond part. Changing the parser in the script to use "toISOString()" instead of "kendo.toString(value, 'G', this.culture.name)" resolves the issue.