How to: Prevent End-Users from Editing Appointments
- 2 minutes to read
In some real-life applications it might be necessary to prevent end-users from editing (copying, deleting, dragging, etc.) the appointments shown within the SchedulerControl. For instance, it’s necessary to show all the appointments to end-users as read-only.
To do this, access the customization settings via the SchedulerControl.OptionsCustomization property to implement end-user restrictions in your scheduling application. The following restrictions are possible in the ASPxScheduler:
Restriction | Description |
---|---|
SchedulerOptionsCustomization.AllowAppointmentConflicts | Specifies whether an end-user is allowed to share the scheduled time between two or more appointments. |
SchedulerOptionsCustomization.AllowAppointmentCopy | Specifies whether an end-user is allowed to copy appointments. |
SchedulerOptionsCustomization.AllowAppointmentCreate | Specifies whether an end-user is allowed to create new appointments. |
SchedulerOptionsCustomization.AllowAppointmentDelete | Specifies whether an end-user is allowed to delete appointments. |
SchedulerOptionsCustomization.AllowAppointmentDrag | Specifies whether an end-user is allowed to drag and drop appointments to another time slot or date. |
SchedulerOptionsCustomization.AllowAppointmentDragBetweenResources | Specifies whether an end-user is allowed to drag and drop appointments between resources. |
SchedulerOptionsCustomization.AllowAppointmentEdit | Specifies whether an end-user is allowed to edit appointments. |
SchedulerOptionsCustomization.AllowAppointmentMultiSelect | Specifies whether an end-user is allowed to select more than one appointment simultaneously. |
SchedulerOptionsCustomization.AllowAppointmentResize | Specifies whether an end-user is allowed to change the time boundaries of appointments. |
SchedulerOptionsCustomization.AllowInplaceEditor | Specifies whether an in-place editor can be activated for an appointment. |
You can set a corresponding value as required, e.g. set it to UsedAppointmentType.None to prohibit a particular action for all appointment types, or set it to UsedAppointmentType.Recurring to allow it for recurring appointments only.
If you set one of the OptionsCustomization.Allow* properties to UsedAppointmentType.Custom, a related Allow* event will fire, in which you can decide how to handle a particular case. For example, to prevent user Sam from dragging appointments, you can use the following code:
ASPxScheduler1.OptionsCustomization.AllowAppointmentDrag =
UsedAppointmentType.Custom;
ASPxScheduler1.AllowAppointmentDrag +=
new AppointmentOperationEventHandler(ASPxScheduler1_AllowAppointmentDrag);
// ...
void ASPxScheduler1_AllowAppointmentDrag(object sender,
AppointmentOperationEventArgs e) {
if (user_id == "Sam") e.Allow = false;
}