Reputation: 4412
I have been using Kendo controls for a while and their inclusion on HTML/Razor webpages is fairly simple: Here are some working examples:
@(Html.Kendo().Grid<ProjectName.Models.MyModel>()
...
@(Html.Kendo().DropDownList()
...
@(Html.Kendo().Button()
...
I want to start using the Kendo Scheduler and in their example they have this:
@(Html.Kendo().Scheduler<Kendo.Mvc.Examples.Models.Scheduler.TaskViewModel>()
So I tried this:
@(Html.Kendo().Scheduler<ProjectName.Models.MyModel>()
but it shows this error in the editor:
namespace ProjectName.Models.MyModel
Error:
The type 'ProjectName.Models.MyModel' cannot be used as type parameter 'T' in the generic type or method 'Kendo.Mvc.UI.Fluent.WidgetFactory.Scheduler()'. There is no implicit reference conversion from 'ProjectName.Models.MyModel' to 'Kendo.Mvc.UI.ISchedulerEvent'
What am I doing wrong?
Upvotes: 3
Views: 2014
Reputation: 1086
The Model that you are binding to the scheduler must inherit from "ISchedulerEvent" interface. This interface is present in "Kendo.Mvc.UI" namespace. e.g.
// ViewModel required for managing appointments
public class SchedulerViewModel : ISchedulerEvent
{
public string Title { get; set; }
public string Description { get; set; }
public bool IsAllDay { get; set; }
public DateTime Start { get; set; }
public DateTime End { get; set; }
public string StartTimezone { get; set; }
public string EndTimezone { get; set; }
public string RecurrenceRule { get; set; }
public string RecurrenceException { get; set; }
//Add your own property here
}
Hope this will solve the error.
Upvotes: 8