asp.net-mvc - 使用 Kendo 调度程序的问题

标签 asp.net-mvc razor kendo-ui telerik kendo-scheduler

我使用 Kendo 控件已经有一段时间了,它们在 HTML/Razor 网页中的包含相当简单:以下是一些工作示例:

@(Html.Kendo().Grid<ProjectName.Models.MyModel>()
...

@(Html.Kendo().DropDownList()
...

@(Html.Kendo().Button()
...

我想开始使用 Kendo Scheduler在他们的例子中,他们有这个:

@(Html.Kendo().Scheduler<Kendo.Mvc.Examples.Models.Scheduler.TaskViewModel>()

所以我尝试了这个:

@(Html.Kendo().Scheduler<ProjectName.Models.MyModel>()

但它在编辑器中显示此错误:

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'

我做错了什么?

最佳答案

您绑定(bind)到调度程序的模型必须继承自 "ISchedulerEvent" 接口(interface)。此接口(interface)存在于“Kendo.Mvc.UI”命名空间中。例如

 // 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
}

希望这能解决错误。

关于asp.net-mvc - 使用 Kendo 调度程序的问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27187009/

相关文章:

asp.net - 如何根据角色显示或隐藏控件 - ASP.NET MVC 4 Razor

c# - HttpClient.PutAsync- "Entity only allows writes with a JSON Content-Type header"

javascript - 获取 MVC 模型数据并将其传递到 AngularJS Controller

kendo-ui - Kendo Treeview 不显示从 Controller 获取 json 结果的记录

kendo-ui - 如何禁用过去的日期而不将它们隐藏在 Kendo 日期选择器中?

asp.net-mvc - ASP.NET MVC "GET"和 "POST"常数

asp.net - 允许在 ASP.NET MVC 表单上使用多个按钮的最佳方法是什么?

c# - 如何在 Razor 的部分 View 中获取 HTMLPREFIX

c# - 如何在其 View 中仅刷新局部 View ?

jquery - 对 Kendocombobox 的项目进行排序