Question

I'm using the Scheduler control. Double clicking an event opens a dialog to allow it to be edited. Amongst other controls, the dialog has a Time Zone button and a Owner drop down.

How do I go about removing these?

Any help would be greatly appreciated.

Thanks.

Abrar

Était-ce utile?

La solution

If you are looking to customize the pop-up editor for the Scheduler, a convenient way is to create a Scheduler Editor Template to pull it off. I went through a lot of heartache with the lack of documentation for the ASP.NET MVC Wrapper version of the Scheduler from Kendo (documented here), but there was a good (downloadable) example that came out of my findings. You can download that example here.

The Call from the Scheduler MVC Wrapper:

.Editable(edit =>
{
    edit.TemplateName("SchedulerEditorTemplate");
})

My structure with the View and Partial View:

/Home (folder)
    /EditorTemplates (folder)
        SchedulerEditorTemplate.cshtml
    Index.cshtml

What the Partial View is for SchedulerEditorTemplate is just a form like you would have elsewhere in your MVC web app complete with a @model, etc. You just get to build that Editor Template much like a normal View page with a form. Just make sure that your Model class used in the Partial View is the same as the Ajax Methods used to Read, Create, Update and Destroy for the Scheduler to make sure you get all the data you need.

Here's an example of my Calendar View Model:

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

    }
}

One of the primary things you need to do for any custom model class is to inherit from the ISchedulerEvent, otherwise your custom model will not work right.

public class CalendarAppointmentViewModel : ISchedulerEvent
{
    ...
}
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top