This example demonstrates how to use the SetAppointmentFormTemplateContent method to create a custom appointment form.
Call the control's MVCxSchedulerOptionsForms.SetAppointmentFormTemplateContent method to add a custom appointment form to the SchedulerPartial view.
settings.OptionsForms.SetAppointmentFormTemplateContent(c => {
var container = (CustomAppointmentTemplateContainer)c;
var schedule = ViewData["EditableSchedule"] != null
? (Schedule)ViewData["EditableSchedule"]
: new Schedule() {
ID = container.Appointment.Id == null ? -1 : (int)container.Appointment.Id,
<!-- ... -->
};
ViewBag.DeleteButtonEnabled = container.CanDeleteAppointment;
ViewBag.IsRecurring = container.Appointment.IsRecurring;
ViewBag.AppointmentRecurrenceFormSettings = CreateAppointmentRecurrenceFormSettings(container);
ViewBag.ResourceDataSource = container.ResourceDataSource;
ViewBag.StatusDataSource = container.StatusDataSource;
ViewBag.LabelDataSource = container.LabelDataSource;
ViewBag.ReminderDataSource = container.ReminderDataSource;
Html.RenderPartial("CustomAppointmentFormPartial", schedule);
});
Create an AppointmentFormTemplateContainer to add custom fields to your appointment form and handle the control's server-side ASPxScheduler.AppointmentFormShowing event to replace the default container with the custom container.
settings.AppointmentFormShowing = (sender, e) => {
var scheduler = sender as MVCxScheduler;
if (scheduler != null)
e.Container = new CustomAppointmentTemplateContainer(scheduler);
};
- SchedulerPartial.cshtml
- CustomAppointmentFormPartial.cstml
- Index.cshtml
- Scheduling.cs (VB: Scheduling.vb)
- Scheduler for ASP.NET Web Forms - How to construct an appointment edit form with custom fields
- Scheduler for ASP.NET MVC - Insert-Update-Delete appointment feature
(you will be redirected to DevExpress.com to submit your response)