Skip to main content

Recurrence Dialog as a Standalone Form

Your application may not require the entire scheduler functionality. There are times when only a part of it is really needed. A common problem is the use of the Recurrence form, which is the set of controls designed to specify a recurrence rule as a standalone form.

In this case, you don’t have to instantiate the MVC Scheduler. The AppointmentRecurrenceFormExtension object is what you need to accomplish this task.

Use the AppointmentRecurrenceFormExtension.Bind method to bind the form to the RecurrenceInfo object instance.

@Html.DevExpress().AppointmentRecurrenceForm(
    settings => {
        settings.Name = "RecurrenceControl";
        settings.IsRecurring = Model != null;
}).Bind(Model).GetHtml()

The Recurrence form is displayed to the end-user so that he/she can modify the recurrence rule as needs dictate. When all modifications are completed, the controller gets the result using the AppointmentRecurrenceFormExtension.GetValue method.

public ActionResult RecurrenceFormInfo() {
    Appointment pattern = new Appointment(AppointmentType.Pattern,
        new DateTime(2012, 10, 20, 3, 0, 0), new DateTime(2012, 10, 20, 4, 0, 0));
    RecurrenceInfo recurrenceInfo = AppointmentRecurrenceFormExtension.GetValue("RecurrenceControl", pattern);
    return View("RecurrenceFormInfo", (object)recurrenceInfo.ToXml());
}