Hi Arshaw,
I was very excited to see a calendar plugin like fullcalendar. i am trying to use fullcalendar to display events for each month. But the events are not displayed on the calendar.
My code is :
[AcceptVerbs(HttpVerbs.Get)] public JsonResult HighlightCalendar() { var tasksList = new List();
tasksList.Add(new HighlightMonthlyEvents
{
id = 1,
EventName = "Google search",
EventStartDate = ToUnixTimespan(DateTime.Now),
EventEndDate = ToUnixTimespan(DateTime.Now.AddHours(4)),
url = "www.google.com"
});
tasksList.Add(new HighlightMonthlyEvents
{
id = 1,
EventName = "Bing search",
EventStartDate = ToUnixTimespan(DateTime.Now.AddDays(1)),
EventEndDate = ToUnixTimespan(DateTime.Now.AddDays(1).AddHours(4)),
url = "www.bing.com"
});
var highlightDays = Jayrock.Json.Conversion.JsonConvert.ExportToString(tasksList.ToArray());
return Json(highlightDays, JsonRequestBehavior.AllowGet);
}
$(function () {
// FullCalendar
$('.fullcalendar').fullCalendar({ theme: true, header: { left: 'today prev,next', center: '', right: '' }, defaultView: 'month', editable: false, events: function (callback) { // do some asynchronous ajax contentType: "application/json; charset=utf-8", $.getJSON("/Test/HighlightCalendar/", null, function (result) { var calevents = new Array(); var results = eval(result); eval(results.length); if (results != null) { for (i in results) { var calEvent = results[i];
calevents.push(calEvent)
}
}
alert(calevents.length);
// then, pass the CalEvent array to the callback
callback(calevents);
});
}
});
My JSON looks like:
[{"id":1,"allDay":false,"title":"Google search","start":1279750267,"end":1279764667,"url":"www.google.com"},{"id":2,"allDay":false,"title":"Bing search","start":1279836667,"end":1279851067,"url":"www.bing.com"}]
What do you think is wrong? Please help!!
Thanks a Lot!! Anusha