Skip to main content

ASPxScheduler.AllowAppointmentCreate Event

Occurs when the scheduler initialize an appointment.

Namespace: DevExpress.Web.ASPxScheduler

Assembly: DevExpress.Web.ASPxScheduler.v24.1.dll

NuGet Package: DevExpress.Web.Scheduler

Declaration

public event AppointmentOperationEventHandler AllowAppointmentCreate

Event Data

The AllowAppointmentCreate event's data class is AppointmentOperationEventArgs. The following properties provide information specific to this event:

Property Description
Allow Gets or sets a value indicating whether an end-user is allowed to perform a particular action.
Appointment Gets the appointment for which the event was raised. Inherited from AppointmentEventArgs.
Recurring Gets or sets a value indicating if the appointment is recurring.

Remarks

The AllowAppointmentCreate event is in effect if the SchedulerOptionsCustomization.AllowAppointmentCreate property is set to Custom.

Refer to the SchedulerControl.AllowAppointmentCreate topic, to learn more.

protected void Page_Load(object sender, EventArgs e) {    
    ASPxScheduler1.OptionsCustomization.AllowAppointmentCreate = UsedAppointmentType.Custom;
    ASPxScheduler1.AllowAppointmentCreate += ASPxScheduler1_AllowAppointmentCreate;
}
void ASPxScheduler1_AllowAppointmentCreate(object sender, AppointmentOperationEventArgs e) {
    e.Allow = IsAllowedByClient(GetClientById(Session["CurrentClientId"]), ScheduleOperationType.Create, e.Appointment, e.Recurring);
}
bool IsAllowedByClient(Client client, ScheduleOperationType operationType, Appointment appointment, bool isRecurring) {
    if(operationType == ScheduleOperationType.Create) {
        return client.Rules.Appointment.Create.IsAllowed(appointment);
    } else {
        return true;
    }
}
See Also