我正在使用调度程序控件。双击一个事件会打开一个对话框以允许对其进行编辑。除其他控件外,该对话框还有一个时区按钮和一个所有者下拉菜单。
我该如何去除这些?
任何帮助将不胜感激。
谢谢。
阿布拉尔
我正在使用调度程序控件。双击一个事件会打开一个对话框以允许对其进行编辑。除其他控件外,该对话框还有一个时区按钮和一个所有者下拉菜单。
我该如何去除这些?
任何帮助将不胜感激。
谢谢。
阿布拉尔
如果您正在寻找自定义调度程序的弹出编辑器,一种方便的方法是创建调度程序编辑器模板来实现它。由于缺少来自 Kendo 的调度程序的 ASP.NET MVC Wrapper 版本的文档(在此处记录),我经历了很多心痛,但是我的发现中有一个很好的(可下载的)示例。您可以在此处下载该示例。
调度程序 MVC 包装器的调用:
.Editable(edit =>
{
edit.TemplateName("SchedulerEditorTemplate");
})
我的视图和部分视图的结构:
/Home (folder)
/EditorTemplates (folder)
SchedulerEditorTemplate.cshtml
Index.cshtml
SchedulerEditorTemplate 的部分视图只是一个表单,就像您在 MVC Web 应用程序的其他地方拥有的一样,带有 @model 等。您只需构建该编辑器模板,就像带有表单的普通视图页面一样。只需确保您在局部视图中使用的模型类与用于调度程序的读取、创建、更新和销毁的 Ajax 方法相同,以确保您获得所需的所有数据。
这是我的日历视图模型的示例:
using Kendo.Mvc.UI;
using System;
using System.Linq;
namespace MyApp.ViewModels.Calendars
{
public class CalendarAppointmentViewModel : ISchedulerEvent
{
// Mandatory Custom Fields
public int AppointmentId { get; set; }
public int EmployeeId { get; set; }
public string EmployeeName { get; set; }
public bool Reminder { get; set; }
public bool IsPending { get; set; }
public bool IsActive { get; set; }
public bool IsCompleted { get; set; }
public bool IsCancelled { get; set; }
// Kendo Fields
public string Title { get; set; }
public string Description { get; set; }
public string Recurrence { get; set; }
public string StartTimezone { get; set; }
public string EndTimezone { get; set; }
private DateTime start;
public DateTime Start
{
get
{
return start;
}
set
{
start = value.ToUniversalTime();
}
}
private DateTime end;
public DateTime End
{
get
{
return end;
}
set
{
end = value.ToUniversalTime();
}
}
public string RecurrenceRule { get; set; }
public int? RecurrenceID { get; set; }
public string RecurrenceException { get; set; }
public bool IsAllDay { get; set; }
}
}
对于任何自定义模型类,您需要做的主要事情之一是从 ISchedulerEvent 继承,否则您的自定义模型将无法正常工作。
public class CalendarAppointmentViewModel : ISchedulerEvent
{
...
}