第一次使用 MVC 和 Kendo Scheduler,我无法将数据显示在日历上。我有以下型号
public class Events : ISchedulerEvent
{
public int Id { get; set; }
public string Description { get; set; }
public DateTime End { get; set; }
public string EndTimezone { get; set; }
public bool IsAllDay { get; set; }
public string RecurrenceException { get; set; }
public string RecurrenceRule { get; set; }
public DateTime Start { get; set; }
public string StartTimezone { get; set; }
public string Title { get; set; }
}
我的控制器只是简单地创建这个类的一个实例并向其中添加数据并返回一个列表,如下所示:
public ActionResult Index()
{
return View(GetAll());
}
public List<Events> GetAll()
{
var p = new List<Events>();
p.Add(new Events
{
Id = 1,
Title = "Board Meeting",
Start = DateTime.Now,
End = DateTime.Now.AddHours(2)
});
return p;
}
我的看法很简单:
@using Kendo.Mvc.UI;
@(Html.Kendo().Scheduler<Optic.Models.Calendar.Events>()
.Name("scheduler")
.Date(new DateTime(2014, 1, 22))
.StartTime(new DateTime(2013, 6, 13, 07, 00, 00))
.EndTime(new DateTime(2013, 6, 13, 21, 00, 00))
.Editable(false)
.Height(600)
.Views(views =>
{
views.DayView();
views.WeekView();
views.MonthView(month => month.Selected(true));
views.AgendaView();
})
.DataSource(d => d
.Model(m => m.Id(f => f.Id))
)
.BindTo(Model)
)
日历加载并从一天切换到一个月等工作,但日历中不会填充任何数据。我检查了模型,它确实有数据。为了让数据显示在日历上,我是否遗漏了什么?任何帮助将不胜感激。