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

Formatting formatJSONDate

1 Answer 159 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Mario Priebe
Top achievements
Rank 1
Mario Priebe asked on 07 Sep 2012, 06:57 AM
I've problems to format the (nullable) DateTime within a grid cell.
It shows me "/Date(1346849354810)/" instead the formatted date:

My Binding 

columns.Bound(p => p.Incentiv.CreatedDate).Format("{0:d}")
.ClientTemplate("#= (Incentiv.CreatedDate==null ? '':Incentiv.CreatedDate) #");

The second problem is, if I check of HasValue i get an undefined:

columns.Bound(p => p.Incentiv.CreatedDate).Format("{0:d}")
.ClientTemplate("#= (Incentiv.CreatedDate.HasValue ? '':Incentiv.CreatedDate.Value) #");

if i use GetValueOrDefault()  I get an error: "Bound columns require a field or property access expression."

columns.Bound(p => p.Incentiv.CreatedDate.GetValueOrDefault()).Format("{0:d}")
.ClientTemplate("#= (Incentiv.CreatedDate == null ? '':Incentiv.CreatedDate) #");

1 Answer, 1 is accepted

Sort by
0
Mario Priebe
Top achievements
Rank 1
answered on 10 Sep 2012, 11:07 AM
I found the solution by myself.
The problem was the order of including js files. the right ordering e.g.:

<script src="/Scripts/Kendo/kendo.aspnetmvc.min.js"></script>
<script src="/Scripts/Kendo/kendo.grid.min.js"></script>
<script src="/Scripts/Kendo/kendo.web.min.js"></script>



Tags
Grid
Asked by
Mario Priebe
Top achievements
Rank 1
Answers by
Mario Priebe
Top achievements
Rank 1
Share this question
or