DxScheduler.AppointmentCreating Event
Fires before an appointment is created.
Namespace: DevExpress.Blazor
Assembly: DevExpress.Blazor.v24.2.dll
NuGet Package: DevExpress.Blazor
Declaration
[Parameter]
public EventCallback<SchedulerAppointmentOperationEventArgs> AppointmentCreating { get; set; }
Event Data
The AppointmentCreating event's data class is SchedulerAppointmentOperationEventArgs. The following properties provide information specific to this event:
Property | Description |
---|---|
Appointment | Specifies the target appointment. |
Cancel | Gets or sets a value indicating whether the event should be canceled. Inherited from CancelEventArgs. |
Remarks
To cancel the operation, use the event argument’s Cancel property. If you need to access the appointment and modify its properties, use the event argument’s Appointment property.
The following code snippet uses the Cancel
property to restrict non-Admin users to create appointments in the DxScheduler.
<DxScheduler StartDate="@(new DateTime(2018, 10, 10))"
DataStorage="@DataStorage"
AppointmentCreating="(e) => AppointmentCreating(e)">
</DxScheduler>
@if (PopupVisible) {
<DxPopup HeaderText="Warning" CloseButtonClick="@(() => PopupVisible = false)">
<p>You are not allowed to create new appointments in the scheduler. Please contact your system administrator for details.</p>
</DxPopup>
}
@code {
bool popupVisible = false;
bool PopupVisible { get => popupVisible; set { popupVisible = value; InvokeAsync(StateHasChanged); } }
void AppointmentCreating(SchedulerAppointmentOperationEventArgs e) {
if (currentUser.Role != "Admin") {
e.Cancel = true;
PopupVisible = true;
}
}
}
See Also