Skip to main content
A newer version of this page is available. .

DxScheduler.AppointmentInserted Event

Fires after a new appointment is added to the AppointmentsSource object.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v22.1.dll

NuGet Package: DevExpress.Blazor

Declaration

[Parameter]
public EventCallback<DxSchedulerAppointmentItem> AppointmentInserted { get; set; }

Parameters

Type Description
DxSchedulerAppointmentItem

A DxSchedulerAppointmentItem object that stores an added appointment.

Remarks

Use the AppointmentInserted event to access an added appointment after it has been saved to the AppointmentsSource object.

Note

To cancel an appointment insertion or to modify an inserted appointment before it is saved, use the AppointmentInserting event.

The code below uses the AppointmentInserting event to change the added appointment’s Id property, and then detects this property’s value to access the appointment after it has been added to the AppointmentsSource object.

<DxScheduler DataStorage="..."
             AppointmentInserting="(e) => AppointmentInserting(e)"
             AppointmentInserted="async (e) => await AppointmentInserted(e)">
    <DxSchedulerDayView ShowWorkTimeOnly="true"></DxSchedulerDayView>
</DxScheduler>


@code {

    void AppointmentInserting(SchedulerAppointmentOperationEventArgs e) {
        e.Appointment.Id = -1;
    }

    async Task AppointmentInserted(DxSchedulerAppointmentItem e) {
        MedicalAppointments insertedItem = (DataStorage.AppointmentsSource as List<MedicalAppointments>).Where(m => m.Id == -1).FirstOrDefault();
        insertedItem.Id = 0;
        await Http.PostJsonAsync<MedicalAppointments>("https://MyWebService.com/api/MedicalAppointments/", insertedItem);
    }
}    

View Example: Scheduler for Blazor - How to implement CRUD operations with a Web API Service

See Also