I am having an issue creating a template for the Scheduler. What I am trying to do is set the event style class to one of four classes depending on the value of a given eventstate value from the model. here is what I have for my whole kendo mvc schelduer with template. Can someone help show me how to write the template so it can do this and be in a valid state.
@(Html.Kendo().Scheduler<SBAS_Web.Models.AppointmentModel>()
.Name("scheduler")
.Date(new DateTime(startdate.Year, startdate.Month, startdate.Day))
.StartTime(new DateTime(startdate.Year, startdate.Month, startdate.Day, 8, 00, 00))
.ShowWorkHours(true)
.Views(views => views.DayView(day => day.Selected(true)))
.Editable(false)
.AllDaySlot(false)
.EventTemplate(
"<div class='appointment-template # if(AppointmentState == 'Default'){# DefaultColor #}# if(AppointmentState == 'Completed'){# CompletedColor #}# if(AppointmentState == 'ReadyForInvoicing'){# ReadyForInvoicingColor #}# if(AppointmentState == 'Invoiced'){# InvoicedColor #}#'>" +
"<p>" +
"#= kendo.toString(start, 'hh:mm') # - #= kendo.toString(end, 'hh:mm') #" +
"</p>" +
"<p>#= title #</p>" +
"</div>")
.Timezone("Etc/UTC")
.DataSource(d => d
.Model(m =>
{
m.Id(f => f.AppointmentId);
m.Field(f => f.Title).DefaultValue("No title");
m.RecurrenceId(f => f.RecurrenceID);
})
.Events(e => e.Error("error_handler"))
.Read("Appointments_Read", "Appointment")
//.Update("Appointments_Update", "Appointment")
)
.Group(grp => grp.Orientation(SchedulerGroupOrientation.Vertical))
)
@(Html.Kendo().Scheduler<SBAS_Web.Models.AppointmentModel>()
.Name("scheduler")
.Date(new DateTime(startdate.Year, startdate.Month, startdate.Day))
.StartTime(new DateTime(startdate.Year, startdate.Month, startdate.Day, 8, 00, 00))
.ShowWorkHours(true)
.Views(views => views.DayView(day => day.Selected(true)))
.Editable(false)
.AllDaySlot(false)
.EventTemplate(
"<div class='appointment-template # if(AppointmentState == 'Default'){# DefaultColor #}# if(AppointmentState == 'Completed'){# CompletedColor #}# if(AppointmentState == 'ReadyForInvoicing'){# ReadyForInvoicingColor #}# if(AppointmentState == 'Invoiced'){# InvoicedColor #}#'>" +
"<p>" +
"#= kendo.toString(start, 'hh:mm') # - #= kendo.toString(end, 'hh:mm') #" +
"</p>" +
"<p>#= title #</p>" +
"</div>")
.Timezone("Etc/UTC")
.DataSource(d => d
.Model(m =>
{
m.Id(f => f.AppointmentId);
m.Field(f => f.Title).DefaultValue("No title");
m.RecurrenceId(f => f.RecurrenceID);
})
.Events(e => e.Error("error_handler"))
.Read("Appointments_Read", "Appointment")
//.Update("Appointments_Update", "Appointment")
)
.Group(grp => grp.Orientation(SchedulerGroupOrientation.Vertical))
)