C# 4.0 未显示完整的日历事件
我在fullcalendar上显示事件时遇到一些问题。有人能帮忙吗? 在我在数据库中介绍结束日期之前,一切都很顺利。我已经尝试过从日历中删除它,但仍然不起作用 我正在尝试绑定mvc控制器返回的json数据。Json看起来不错,如下所示:C# 4.0 未显示完整的日历事件,c#-4.0,asp.net-mvc-4,fullcalendar,C# 4.0,Asp.net Mvc 4,Fullcalendar,我在fullcalendar上显示事件时遇到一些问题。有人能帮忙吗? 在我在数据库中介绍结束日期之前,一切都很顺利。我已经尝试过从日历中删除它,但仍然不起作用 我正在尝试绑定mvc控制器返回的json数据。Json看起来不错,如下所示: { id = 1, title = "XYZ Apple", start = "2013-10-02T00:00:00.0000000", end = "2013-10-06T00:00:00.0000000", allDay = true } { id
{ id = 1, title = "XYZ Apple", start = "2013-10-02T00:00:00.0000000", end = "2013-10-06T00:00:00.0000000", allDay = true }
{ id = 3, title = "XYZ Apple", start = "2013-10-03T00:00:00.0000000", end = "2013-10-10T00:00:00.0000000", allDay = true }
{ id = 4, title = "XYZ Apple", start = "2013-10-04T00:00:00.0000000", end = "2013-10-07T00:00:00.0000000", allDay = true }
{ id = 5, title = "XYZ Apple", start = "2013-10-07T00:00:00.0000000", end = null, allDay = true }
{ id = 6, title = "XYZ Apple", start = "2013-10-08T00:00:00.0000000", end = "2013-10-08T00:00:00.0000000", allDay = true }
{ id = 7, title = "XYZ Apple", start = "2013-10-09T00:00:00.0000000", end = "2013-10-15T00:00:00.0000000", allDay = true }
加载时返回自定义错误:
“获取事件时出错!”
这是我的日历
var calendar = {
header: {
left: 'prev,next',
center: 'title',
right: 'today, basicDay,basicWeek,month'
},
defaultView: 'month',
buttonText: {
today: 'Today',
day: 'Day',
week: 'Week',
month: 'Month',
prev: 'Prev',
next: 'Next',
},
weekends: true,
editable: true,
events: {
url: 'FullCalendar/GetEvents',
color: 'yellow',
error: function () {
alert('Error while Getting events!');
}
}
};
myCalendar.fullCalendar(calendar);
你的JSON不好。应该是这样的:
[{"id":"1","title":"XYZ Apple","start":"2013-10-02T00:00:00.0000000","end":"2013-10-06T00:00:00.0000000","allDay":"true"},
{"id":"3","title":"XYZ Apple","start":"2013-10-03T00:00:00.0000000","end":"2013-10-10T00:00:00.0000000","allDay":"true"}]
您可以在以下位置验证JSON。在您的JSON数据中尝试以下
“全天”:“false”
。
也许对你有帮助。如果它不起作用,那么静态地放置json数据,并尝试找出您在哪里工作
events: [
{ id = 1, title = "XYZ Apple", start = "2013-10-02T00:00:00.0000000", end = "2013-10-06T00:00:00.0000000", allDay = true },
{ id = 3, title = "XYZ Apple", start = "2013-10-03T00:00:00.0000000", end = "2013-10-10T00:00:00.0000000", allDay = true },
{ id = 4, title = "XYZ Apple", start = "2013-10-04T00:00:00.0000000", end = "2013-10-07T00:00:00.0000000", allDay = true },
{ id = 6, title = "XYZ Apple", start = "2013-10-08T00:00:00.0000000", end = "2013-10-08T00:00:00.0000000", allDay = true },
{ id = 7, title = "XYZ Apple", start = "2013-10-09T00:00:00.0000000", end = "2013-10-15T00:00:00.0000000", allDay = true }]
问题似乎是源的URL正在呈现。当我使用url作为“GetEvents”并从同一个根目录运行应用程序时,它可以工作,我现在正在这样做。