Skip to main content
All docs
V24.2

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

User Actions

  • 7 minutes to read

#Restrict/Limit User Actions

The DevExpress Blazor Scheduler allows you to restrict end-user operations that modify appointments. Use the following properties to specify operation availability:

Event Description
AllowCreateAppointment Specifies whether users can create new appointments.
AllowEditAppointment Specifies whether users can edit appointments.
AllowDeleteAppointment Specifies whether users can delete appointments.
AllowDragAppointment Specifies whether users can drag appointments.
AllowDragAppointmentBetweenResources Specifies whether users can drag-and-drop appointments between resource groups.
AllowResizeAppointment Specifies whether users can resize appointments.
@using Data

<DxScheduler StartDate="@DateTime.Today"
             DataStorage="@DataStorage"
             AllowCreateAppointment="false"
             AllowEditAppointment="false"
             AllowDeleteAppointment="false">
    <DxSchedulerWeekView/>
</DxScheduler>

@code {
    DxSchedulerDataStorage DataStorage = new DxSchedulerDataStorage() {
        AppointmentsSource = AppointmentCollection.GetAppointments(),
        AppointmentMappings = new DxSchedulerAppointmentMappings() {
            Type = "AppointmentType",
            Start = "StartDate",
            End = "EndDate",
            Subject = "Caption",
            AllDay = "AllDay",
            Location = "Location",
            Description = "Description",
            LabelId = "Label",
            StatusId = "Status",
            RecurrenceInfo = "Recurrence"
        }
    };
}

Run Demo: Scheduler - Restrict/Limit User Actions

#Customize User Actions

The DevExpress Blazor Scheduler includes events that allow you to customize user actions. You can implement additional functionality or cancel actions when necessary. You can even implement a role-based system where users can interact with appointments based on their permissions.

Event Description
AppointmentCreating Fires before an appointment is created.
AppointmentCreated Fires after an appointment is created.
AppointmentInserted Fires after a new appointment is added to the AppointmentsSource object.
AppointmentInserting Fires before a new appointment is added to the AppointmentsSource object.
AppointmentUpdating Fires before an updated appointment is saved to the AppointmentsSource object.
AppointmentUpdated Fires after an updated appointment is saved to the AppointmentsSource object.
AppointmentRemoved Fires after an appointment is removed from the AppointmentsSource object.
AppointmentRemoving Fires before an appointment is removed from the AppointmentsSource object.
AppointmentStartDragging Fires when a user starts dragging an appointment.
AppointmentStartResizing Fires when a user starts resizing an appointment.
AppointmentDraggingBetweenResources Fires before an appointment is removed from the AppointmentsSource object.

The following code snippet allows only a certain type of appointment resize operation: the resulting appointment must occur within work hours.

Razor
<DxScheduler StartDate="@DateTime.Today"
             DataStorage="@DataStorage"
             GroupType="SchedulerGroupType.Resource"
             AppointmentStartResizing="OnStartResizing">
    ...
</DxScheduler>

<DxPopup @bind-Visible="@AlertVisible"
         CloseOnEscape="true"
         CloseOnOutsideClick="true"
         ShowCloseButton="true"
         HeaderText="Warning!"
         BodyText="The appointment can belong only to the current user and can start and end only during the working time interval.">
</DxPopup>

@code {
    ...

    DxSchedulerTimeSpanRange WorkTime = new DxSchedulerTimeSpanRange(TimeSpan.FromHours(9), TimeSpan.FromHours(18));
    bool AlertVisible = false;
    int CurrentUserResourceId = 0;
    bool IsCurrentUsersAppointment(DxSchedulerAppointmentItem apt) => apt.ResourceId as int? == CurrentUserResourceId;

    bool IsInWorkTime(DxSchedulerAppointmentItem apt) =>
        apt.AllDay ||
        apt.Start - apt.Start.Date >= WorkTime.Start
        && WorkTime.End >= apt.End - apt.End.Date;

    void OnStartResizing(SchedulerAppointmentOperationEventArgs args) {
        if (!IsCurrentUsersAppointment(args.Appointment) || !IsInWorkTime(args.Appointment)) {
            args.Cancel = true;
            AlertVisible = showAlert;
        }
    }
}

Run Demo: Scheduler - Customize User Actions

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