开发者

Fullcalendar in ASP.NET and JSON response

I am fetching my events with webservice:

     Public Function webGetCalendarEvents(ByVal startDate As String, ByVal endDate As String) As String
        Dim sDate As DateTime = ToUnixTimeSpan(startDate)
        Dim eDate As DateTim开发者_StackOverflow社区e = ToUnixTimeSpan(endDate)
        Dim DS As DataSet = DBStoredProcedures.GetEventsCalendarJSON(95, sDate, eDate)
        DS.Tables(0).TableName = "events"
        Dim dataTable As DataTable = DS.Tables(0)
        Dim jsonEvents As String = Newtonsoft.Json.JsonConvert.SerializeObject(dataTable)
Return jsonEvents

The json response is like:

    [
   {
      "id":589311,
      "title":"My Title",
      "priority":"",
      "start":"2011-09-19T08:00",
      "end":"2011-09-26T16:00",
      "allDay":"false",
      "editable":"true",
      "EOSid":0
   }
]

The problem is, that all my events are shown as allDay events. It seems like "false" value of "allDay" is not recognized.

I am evaluating the response inside fullcalendar.js file (version 1.5.2., line around 981):

success: function (events) {
                        events = (typeof events.d) == 'string' ? eval('(' + events.d + ')') : events.d || [];

How can I render events to accept "allDay" parameter?


SOLVED: I changed my SQL procedure where I was generating "allDay" parameter. I changed from:

CASE WHEN EventTypeID=3 THEN 'false' ELSE 'true' END as allDay

to:

CASE WHEN EventTypeID=3 THEN CAST(0 as BIT) ELSE CAST(1 as BIT) END as allDay

This gave me JSON response:

{"allDay": false}

instead of:

{"allDay": "false"}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜