search envelope-o feed check
Home Unanswered Active Tags New Question
user comment-o

'CalendarController.Dpm.OnInit(InitArgs)': no suitable method found to override

Asked by Christopher W Navarro
7 years ago.

Hello,

I am following your article on the Open source version of Daypilot Calendar from (https://code.daypilot.org/10607/monthly-event-calendar-for-asp-net-mvc-and-jquery-open-source) but when I build I get an error that the OnInit method is not suitable to override.

I'm using Visual Studio 2015.

This is my Controller Action, I've added the assembly as a reference in my project and added the namespace to the web.config file:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Intranet.DataAccess;
using DayPilot.Web.Mvc;

namespace Intranet.Web.Controllers
{
public class CalendarController : Controller
{
// GET: Calendar
public ActionResult Index()
{
return View();
}
public ActionResult Backend()
{
return new Dpm().CallBack(this);
}

class Dpm : DayPilotMonth
{
protected override void OnInit(InitArgs e)
{
var db = new IntranetContext();
Events = from ev in db.Events select ev;

DataIdField = "Id";
DataTextField = "Description";
DataStartField = "StartDate";
DataEndField = "EndDate";

Update();
}
}
}
}

Answer posted by Dan Letecky [DayPilot]
7 years ago.

It looks like you are missing the following import:

using DayPilot.Web.Mvc.Events.Month;

You can also add the full namespace to the header:

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

Let me know if it didn't help.

Comment posted by Christopher W Navarro
7 years ago.

The import did not fix my error initially, but changed it, now my initArgs was ambiguous.
I removed the other import I had (using DayPilot.Web.Mvc.Events.Calendar;) and then in compiled.

Now to make it work!

Thanks for your help!

This question is more than 1 months old and has been closed. Please create a new question if you have anything to add.