日历不会从aspx页面显示我的数据

时间:2011-11-02 17:39:38

标签: fullcalendar

我正在使用ASP.net在我的日历上显示数据。

我的Feed设置显示在名为feed.aspx的页面上(与我的日历页面位于同一文件夹中)。我在我的日历页面上这样称呼它:

events: {
    url: 'feed.aspx',
    type: 'POST',
    data: {
        custom_param1: 'something',
        custom_param2: 'somethingelse'
    },
    error: function() {
        alert('there was an error while fetching events!');
    },
    color: 'yellow',   // a non-ajax option
    textColor: 'black' // a non-ajax option
}

当我在浏览器中查看feed.aspx时,我看到了:

{"title":"My Test Event","start":"2011-11-02T13:30:57","url":"http://orss.edu","allDay":"false"}

所以我知道我的feed.aspx工作正常。

但无论我尝试什么,都不会显示日历数据。

非常感谢任何帮助。

我的feed.aspx看起来像这样:

Imports System.Web.Script.Serialization
Imports System.Data
Imports System.Data.SqlClient
Public Class feed
Inherits System.Web.UI.Page

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
    Dim dbu As New Utilities.DBUtilities
    Dim conn As SqlConnection
    Dim cmd As SqlCommand
    Dim cmdText As String = "SELECT top(100) * FROM pageList"
    Dim dr As SqlDataReader
    Dim dictData As New Dictionary(Of String, String)
    cmd = dbu.getCommand(cmdText)
    conn = cmd.Connection
    dbu.getCommand(cmdText)
    conn.Open()
    dr = cmd.ExecuteReader()

    If dr.HasRows Then
        Dim i As Integer = 0
        Do While dr.Read()
            'Response.Write(dr.Item("pageID") & "<br>")
            dictData.Add(i.ToString, dr.Item("pageDisplayName"))
            i = i + 1
        Loop
    End If

    Dim testDict As New Dictionary(Of String, String)

    testDict.Add("title", "My Test Event")
    testDict.Add("start", DateTime.Now.ToString("s"))
    testDict.Add("url", "http://oss.edu")
    testDict.Add("allDay", "false")

    Dim serializer As New JavaScriptSerializer()
    Dim json As String = serializer.Serialize(DirectCast(testDict, Object))

    Response.Clear()
    Response.Write(json)
    Response.End()
End Sub

End Class

1 个答案:

答案 0 :(得分:0)

好的,我明白了。这是因为我没有将字符串包装在括号中:“[JSON feed]”

相关问题