I struggled with this problem and resolved it using the .ashx handler as follows
My return class looks like ...
public class Event { public Guid id { get; set; } public string title { get; set; } public string description { get; set; } public long start { get; set; } public long end { get; set; } public bool allDay { get; set; } }
Where DateTime values are converted to long values using ...
private long ConvertToTimestamp(DateTime value) { long epoch = (value.ToUniversalTime().Ticks - 621355968000000000) / 10000000; return epoch; }
And ProcessRequest looks like ...
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/html"; DateTime start = new DateTime(1970, 1, 1); DateTime end = new DateTime(1970, 1, 1); try { start = start.AddSeconds(double.Parse(context.Request.QueryString["start"])); end = end.AddSeconds(double.Parse(context.Request.QueryString["end"])); } catch { start = DateTime.Today; end = DateTime.Today.AddDays(1); } List<Event> evList = new List<Event>(); using (CondoManagerLib.Linq.CondoDataContext Dc = new CondoManagerLib.Linq.CondoDataContext(AppCode.Common.CGlobals.DsnDB)) { evList = (from P in Dc.DataDailySchedules where P.DateBeg>=start && P.DateEnd<=end select new Event { description = P.Description, id = P.RecordGuid, title = P.Reason, start = ConvertToTimestamp(P.DateBeg), end = ConvertToTimestamp(P.DateEnd), allDay = IsAllDay(P.DateBeg, P.DateEnd) }).ToList(); } System.Web.Script.Serialization.JavaScriptSerializer oSerializer = new System.Web.Script.Serialization.JavaScriptSerializer(); String sJSON = oSerializer.Serialize(evList); context.Response.Write(sJSON); }
And my document is ready ...
> $(document).ready(function () { > $('#calendar').fullCalendar({ > header: { left: 'title', center: 'prev,today,next', right: 'month,agendaWeek,agendaDay' }, > editable: false, > aspectRatio: 2.1, > events: "CalendarEvents.ashx", > eventRender: function (event, element) { > element.qtip({ > content: event.description, > position: { corner: { tooltip: 'topLeft', target: 'centerLeft'} }, > style: { border: { width: 1, radius: 3, color: '#000'}, > padding: 5, > textAlign: 'center', > tip: true, > name: 'cream' > } > }); > } > }) > });
The qTip plugin can be found at http://craigsworks.com/projects/qtip/
Hope this helps.