Grid does not display Datetime

2 posts, 0 answers
  1. Martin Ennemoser
    Martin Ennemoser avatar
    9 posts
    Member since:
    Sep 2004

    Posted 25 Oct 2013 Link to this post


    I am unsing Kendo with MVC 5. I am binding my Grid over Ajax ( see attached project and code below). I receive the Date for the LastModified column
    with the Json result but the date is not displayed. 
    I have already made another project with kendo with a similar setup and everything worked perfectly

    Hope you can help

        .Events(events => events.DataBound("onDataBound").DataBinding("onDataBinding").DetailInit("onDetailInit"))
        .DataSource(d => d.Ajax().Read(r => r.Action("CustomersGridData", "Customer")))
        .Columns(c =>
            c.Bound(i => i.Number).Title("Number");        
            c.Bound(i => i.LastModified).Title("LastModified");        
  2. nikobellic
    nikobellic avatar
    46 posts
    Member since:
    Feb 2013

    Posted 25 Oct 2013 Link to this post

    This is a problem with the way regular MVC controllers serialize DateTimes.
    Which is different than the way ApiControllers do it
    "lastModified": "2013-10-25T16:17:43.4521811-04:00"

    You can read more about this problem here.

    So your options are plenty.
    • Change the datetime to a string on your ViewModel
    • Change the way MVC serializes DateTimes (its a little tricky. See here)
    • Switch for a ApiController to return your GridData

    Hope this helps
Back to Top