Grizzly
Grizzly

Reputation: 5943

No suitable method to override

I am using DayPilot to create a calendar in the monthly view.

So following this tutorial, I have this:

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";

    }
}

I am only receiving the error on the OnInit method, but not on the OnFinish method even though in the base class they are pretty much declared the same:

Base Class:

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);
}

What am I doing wrong?

Upvotes: 0

Views: 630

Answers (1)

Pikoh
Pikoh

Reputation: 7703

Add this using:

using DayPilot.Web.Mvc.Events.Month;

Or even better:

protected override void OnInit(DayPilot.Web.Mvc.Events.Month.InitArgs e) {..

Upvotes: 1

Related Questions