FullCalendar events from asp.net ASHX page not displaying

前端 未结 7 1124
慢半拍i
慢半拍i 2021-01-14 15:36

I have been trying to add some events to the fullCalendar using a call to a ASHX page using the following code.

Page script:



        
相关标签:
7条回答
  • 2021-01-14 15:42

    Let's look at what we know and eliminate possibilities:

    • The ASHX page gets called and returnd the ... data:

      So the server-side portion is working just fine, and the code to call out to the server side is working.

    • I paste the values returned directly into the events it displays correctly.

      So the code that handles the response works correctly.

    Logically we see here that code that connects your server response to your calendar's input is not working. Unfortunately, I'm not up on the jQuery fullCalendar method, but perhaps you're missing a callback declaration?

    0 讨论(0)
  • 2021-01-14 15:44

    Your JSON data lost the end item:

    {id: 0,title:'test 1',start: '2010-06-07',end: '2010-06-07',allDay: false}
    
    0 讨论(0)
  • 2021-01-14 15:54

    In case anyone stumbles across this problem. I tried all of the above solutions, but none of them worked. For me, the problem was solved by using an older version of jquery. I switched from version 1.5.2 which was included in the fullcalendar package to version 1.3.2

    0 讨论(0)
  • 2021-01-14 15:58

    I think it might have something to do with your date values.

    0 讨论(0)
  • 2021-01-14 16:00

    FullCalendar events from asp.net ASHX page not displaying is a correct solution to the issue.

    And I used long format for dates.

    And @Steve instead of StringAppending we can use :-

    System.Web.Script.Serialization.JavaScriptSerializer oSerializer =
    new System.Web.Script.Serialization.JavaScriptSerializer();
    String sJSON = oSerializer.Serialize(evList); 
    

    evList being your list containing all events which has the essential properties like id,start,end,description,allDay etc..

    I know this thread is an old thread,but this will be helpful to other users.

    Just collating all the answers.

    0 讨论(0)
  • 2021-01-14 16:03

    Steve, I ran into something similar -- it would render the events if the JSON was directly in the fullCalendar call, but it would not render the identicla JSON coming from an outside URL. I finally got it to work by modifying the JSON so that "id", "title", "start", "end", and "allDay" had the quotes around them.

    So instead of this (to use your sample JSON): [{id: 0,title:'test 1',start: '2010-06-07',allDay: false},{id: 2,title:'test 2',start: '2010-06-07',allDay: false}]

    ...I had this: [{"id": 0,"title":"test 1","start": "2010-06-07","allDay": false},{"id": 2,"title":"test 2","start": "2010-06-07","allDay": false}]

    Now, why it worked locally but not remotely, I can't say.

    0 讨论(0)
提交回复
热议问题