Lesson 3 - Use Scheduler in Complex Views

  • 3 minutes to read

The Lesson 1 - Use Scheduler to Display Appointments in Read-Only Mode document uses a technique that specifies scheduler settings within the view. If your application does not allow users to interact with appointments, this approach works well. However, if the scenario assumes that appointments will be modified, pass the Scheduler settings to the corresponding overloads of the SchedulerExtension.GetAppointmentsToInsert<T>, the SchedulerExtension.GetAppointmentsToUpdate<T> and the SchedulerExtension.GetAppointmentsToRemove<T> methods. Otherwise, appointment display and operations may perform incorrectly.

This approach requires that the SchedulerSettings object is instantiated on the server and passed to the controller and view, so a special helper class (SchedulerSettingsHelper) is implemented to provide the required settings for views and controllers within the application.

@model SchedulerDataObject

@Html.Partial("SchedulerPartial", Model)

A controller method that updates appointments is shown in the code snippet below.

@model SchedulerDataObject

@Html.Partial("SchedulerPartial", Model)

The view is also changed to obtain settings from the helper object.


@Html.DevExpress().Scheduler(SchedulerSettingsHelper.CommonSchedulerSettings).Bind(Model.Appointments, Model.Resources).GetHtml()