我正在使用DayPilot在月视图中创建日历。
所以关注这个tutorial,我有这个:
public class Dpm : DayPilotMonth
{
MyCalendarEntities db = new MyCalendarEntities();
protected override void OnInit(InitArgs e) // this is where I receive the error
{
Update();
}
protected override void OnFinish()
{
// only load the data if an update was requested by an Update() call
if (UpdateType == CallBackUpdateType.None)
{
return;
}
Events = db.Events.ToList();
DataStartField = "StartDate";
DataEndField = "EndDate";
DataTextField = "Event1";
DataIdField = "ID";
}
}
我只收到OnInit
方法的错误,但没有收到OnFinish
方法的错误,即使在基类中它们几乎被声明为相同:
基类:
public class DayPilotMonth
{
protected DayPilotMonth();
public string BackColor { get; set; }
public string HeaderBackColor { get; set; }
public string Id { get; }
public string NonBusinessBackColor { get; set; }
public DayOfWeek ResolvedWeekStart { get; }
public DateTime StartDate { get; set; }
public CallBackUpdateType UpdateType { get; }
public DateTime VisibleEnd { get; }
public DateTime VisibleStart { get; }
public WeekStarts WeekStarts { get; set; }
protected Controller Controller { get; }
protected string DataEndField { get; set; }
protected string DataIdField { get; set; }
protected string DataStartField { get; set; }
protected string DataTextField { get; set; }
protected IEnumerable Events { get; set; }
public ActionResult CallBack(Controller c);
protected virtual void OnBeforeEventRender(BeforeEventRenderArgs e);
protected virtual void OnCommand(CommandArgs e);
protected virtual void OnEventClick(EventClickArgs e);
protected virtual void OnEventMove(EventMoveArgs e);
protected virtual void OnEventResize(EventResizeArgs e);
protected virtual void OnFinish();
protected virtual void OnInit(InitArgs e);
protected virtual void OnPrepare();
protected virtual void OnTimeRangeSelected(TimeRangeSelectedArgs e);
protected void Redirect(string url);
protected void Update();
protected void Update(object data);
protected void Update(CallBackUpdateType type);
protected void Update(object data, CallBackUpdateType type);
}
我做错了什么?
答案 0 :(得分:1)
使用以下方法添加:
using DayPilot.Web.Mvc.Events.Month;
甚至更好:
protected override void OnInit(DayPilot.Web.Mvc.Events.Month.InitArgs e) {..