Formatting formatJSONDate

2 posts, 0 answers
  1. Mario Priebe
    Mario Priebe avatar
    3 posts
    Member since:
    Sep 2012

    Posted 07 Sep 2012 Link to this post

    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) #");
  2. Mario Priebe
    Mario Priebe avatar
    1 posts
    Member since:
    Sep 2012

    Posted 10 Sep 2012 Link to this post

    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>



  3. UI for ASP.NET MVC is VS 2017 Ready
Back to Top