This is a migrated thread and some comments may be shown as answers.
Trouble binding Date property to Grid
1 Answer 50 Views
This is a migrated thread and some comments may be shown as answers.
Tor
Top achievements
Rank 1
Tor asked on 18 Jan 2013, 02:43 PM

I have noticed an error when trying to bind Date properties to the Kendo grid if the property is defined on a sub property of my model class:

Ex:

columns.Bound(p => p.SomeProperty.SomeDate)

For some reason if I define the date like above it will not render out as a Date, but as the JSON representation of the Date
EX: /Date(-62135578800000)/

The interesting part is that is works fine if I define the date property directly on the model like this:

columns.Bound(p => p.SomeDate)

I am using the Kendo server wrapper for Asp.Net MVC

1 Answer, 1 is accepted

Sort by
0
Petur Subev
Telerik team
answered on 22 Jan 2013, 09:32 AM
Hello Tor,

Indeed nested properties are not parsed as DateTime. I could suggest you to set template which parses the date so it is displayed as actual date.
Here an example:

columns.Bound(p => p.SomeProp.Date).ClientTemplate("#=kendo.format('{0:d}', kendo.parseDate(SomeProp.Date))#");

Keep in mind that filtering/sorting/grouping on this field will continue to be applied over that unparsed value.

Kind Regards,
Petur Subev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
Grid
Asked by
Tor
Top achievements
Rank 1
Answers by
Petur Subev
Telerik team
Share this question
or