I am implementing FullCalendar jquery with asp.net mvc 3. It’s working fine but the events are not being returned to the calendar. Firebug console is telling me that they are definitely being returned, they just aren’t showing up on the calendar. I think this is something to do with the date format, I’ve read around but can’t get anything to work. Here is my controller;
public ActionResult CalendarData()
{
DateTime myDate = DateTime.Now;
var eventlist = from e in db.WhatsOns
where e.start >= myDate && e.CalenderDisplay
select e;
return Json(eventlist.ToArray(), JsonRequestBehavior.AllowGet);
}
And the javascript in my view;
<script type="text/javascript">
$(document).ready(function() {
$('#calendar').fullCalendar({
theme: true,
header: {
left: 'prev,next today',
center: 'title',
right:''
},
defaultView: 'month',
editable: false,
events: "/WhatsOn/CalendarData"
});
});
</script>
The cosole output is as follows;
[{"ID":1,"start":"\/Date(1312844400000)\/","end":"\/Date(1313103600000) \/","Name":"Test","Desc":"This is a test event, it will be great!","link":"http:www.link./com","CalenderDisplay":true,"day":null,"whtscount":0,"isActive":false},{"ID":2,"start":"\/Date(1313708400000)\/","end":"\/Date(1314054000000)\/","Name":"This another test event5, it\u0027s on later than the first one.","Desc":"We aere all gpoing to get together and drink,","link":"http:www.link./com","CalenderDisplay":true,"day":null,"whtscount":0,"isActive":false}]
I had a same problem recently, not native in .net, but might be the same issue –
Full calendar requires an array whose every element has clearly defined title and start indexes, at least.
In other words, i didn’t get the events shown, until i formatted the json my action was returning to something like this ( this is json from my app that works ):
Hope this helps,
Cheers