Quantcast
Channel: Telerik Forums RSS
Viewing all articles
Browse latest Browse all 94857

All Dates show up as "/Date(1293868800000)/"

$
0
0

I had a similar problem with using a Kendo UI Grid with my MVC controller method.

Perhaps the problem is DateTime is an object, and JSON serialization converts it to an unreadable but de-serializable string. So the solution I had with my case is I converted the DateTime properties to string using the "ToString" method at the server method.

 
E.g.

[HttpGet]
publicJsonResult KendoUIWidgetRead()
{
    IEnumerable<Newsletters> ie = GetNewsletters();

      

    //Selecting only part of the columns available, instead of the whole range returned by the GetNewsletters() function
    IEnumerable<object> result = ie.Select(a => new
    {
        Title = a.Title,
        Subtitle = a.Subtitle,
        ShowAfter = a.CreateTime.ToString("dd/MM/yyyy") //If the property is a DateTime object, you MUST convert it to a string, otherwise it would not display properly
    });
 
    JsonResult jr = Json(result, JsonRequestBehavior.AllowGet);
    returnjr;
}

Viewing all articles
Browse latest Browse all 94857

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>