2011-11-02 52 views
0

我正在使用ASP.net在我的日曆上顯示數據。日曆不會顯示我的數據從aspx頁面

我的供稿設置顯示在名爲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 

回答

0

好吧,我想通了。這是因爲我沒有像這樣用括號括起字符串:「[JSON feed]」