0

我在全日历中遇到了 AllDay 事件的问题,如果我将 allday 设置为 false,那么它仍然显示为 allday,有人可以看到为什么!?我添加了 allday,所以我不知道我使用的名称是否正确,但日历工作正常,它只是将所有事件显示为 AllDays。

<%@ WebHandler Language="VB" Class="fullcalendarjson" %>

Imports System
Imports System.Collections.Generic
Imports System.Web
Imports System.IO

Public Class fullcalendarjson : Implements IHttpHandler

Public Sub ProcessRequest(context As HttpContext) Implements IHttpHandler.ProcessRequest
    context.Response.ContentType = "text/plain"
    context.Response.Expires = -1
    Dim tasksList As IList(Of CalendarDTO) = New List(Of CalendarDTO)()

    tasksList.Add(New CalendarDTO() With { _
        .id = 1, _
        .title = "Google search", _
        .start = ToUnixTimespan(DateTime.Now), _
        .[end] = ToUnixTimespan(DateTime.Now.AddHours(4)), _
        .url = "www.google.com", _
        .allday = False _
    })
    tasksList.Add(New CalendarDTO() With { _
        .id = 1, _
        .title = "Bing search", _
        .start = ToUnixTimespan(DateTime.Now.AddDays(1)), _
        .[end] = ToUnixTimespan(DateTime.Now.AddDays(1).AddHours(4)), _
        .url = "www.bing.com", _
        .allday = False _
    })
    tasksList.Add(New CalendarDTO() With { _
        .id = 1, _
        .title = "AllDay search", _
        .start = ToUnixTimespan(DateTime.Now.AddDays(3)), _
        .[end] = ToUnixTimespan(DateTime.Now.AddDays(3)), _
        .url = "www.bing.com", _
        .allday = True _
    })
    Dim oSerializer As New System.Web.Script.Serialization.JavaScriptSerializer()
    Dim sJSON As String = oSerializer.Serialize(tasksList)
    context.Response.Write(sJSON)
End Sub

Private Function ToUnixTimespan([date] As DateTime) As Long
    Dim tspan As TimeSpan = [date].ToUniversalTime().Subtract(New DateTime(1970, 1, 1, 0, 0, 0))

    Return CLng(Math.Truncate(tspan.TotalSeconds))
End Function

Public ReadOnly Property IsReusable() As Boolean Implements IHttpHandler.IsReusable
    Get
        Return False
    End Get
End Property
Public Class CalendarDTO
    Public Property id() As Integer
        Get
            Return m_id
        End Get
        Set(value As Integer)
            m_id = Value
        End Set
    End Property
    Private m_id As Integer
    Public Property title() As String
        Get
            Return m_title
        End Get
        Set(value As String)
            m_title = Value
        End Set
    End Property
    Private m_title As String
    Public Property start() As Long
        Get
            Return m_start
        End Get
        Set(value As Long)
            m_start = Value
        End Set
    End Property
    Private m_start As Long
    Public Property [end]() As Long
        Get
            Return m_end
        End Get
        Set(value As Long)
            m_end = Value
        End Set
    End Property
    Private m_end As Long
    Public Property url() As String
        Get
            Return m_url
        End Get
        Set(value As String)
            m_url = Value
        End Set
    End Property
    Private m_url As String
    Public Property allday() As String
        Get
            Return m_allday
        End Get
        Set(value As String)
            m_allday = value
        End Set
    End Property
    Private m_allday As String
End Class

End Class
4

1 回答 1

0

allday 应该是 allDay - d 是大写字母。默认情况下 allDay 为 true - 但可以使用allDayDefault选项控制此默认行为 - http://arshaw.com/fullcalendar/docs/event_data/allDayDefault/

于 2012-10-10T18:24:39.810 回答