Skip to main content

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

ISchedulerRecurrenceInfo.Range Property

Specifies the recurrence range’s type.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v24.2.dll

NuGet Package: DevExpress.Blazor

#Declaration

C#
SchedulerRecurrenceRange Range { get; set; }

#Property Value

Type Description
SchedulerRecurrenceRange

A SchedulerRecurrenceRange enumeration value.

Available values:

Name Description Value
NoEndDate

The recurrence range has no end date, and the appointment repeats indefinitely. The End and OccurrenceCount property values are ignored.

0

OccurrenceCount

The range ends after its recurrence count exceeds the value specified by the OccurrenceCount property. The End property value is ignored.

1

EndByDate

A recurrent appointment ends after the date specified by the End property. The OccurrenceCount property value is ignored.

2

#Remarks

The recurrent appointment reoccurs during the period of time called range. The Start property specifies the range’s start date.

The range’s end date depends on the Range property value.

Range Type

End Date

NoEndDate

The recurrence range has no end date, the appointment repeats indefinitely. The End and OccurrenceCount property values are ignored.

OccurrenceCount

The range ends after its recurrence count exceeds the specified value. (the OccurrenceCount property value). The End property value is ignored.

EndByDate

A recurrent appointment ends after the specified date (the End property value). The OccurrenceCount property value is ignored.

The following example prevents users from creating reccurent appointments that occur only once:

<DxScheduler @bind-StartDate="@StartDate"
             DataStorage="@DataStorage"
             AppointmentUpdating="AppointmentUpdating"
             AppointmentInserting="AppointmentInserting"
             AppointmentFormClosing="AppointmentFormClosing">
    <DxSchedulerWeekView ShowWorkTimeOnly="true"></DxSchedulerWeekView>
</DxScheduler>
<DxPopup @bind-Visible="@AlertVisible"
         CloseOnEscape="true"
         CloseOnOutsideClick="true"
         ShowCloseButton="true"
         HeaderText="Note"
         BodyText="The recurrent appointment occurs only once. Increase the appointment count or create a regular appointment.">
</DxPopup>

@code {
    bool AlertVisible = false;
    bool ValidationFailed = false;
    DateTime StartDate { get; set; } = DateTime.Today;

    DxSchedulerDataStorage DataStorage = new DxSchedulerDataStorage() {
        AppointmentsSource = RecurringAppointmentCollection.GetAppointments(),
        AppointmentMappings = new DxSchedulerAppointmentMappings() {
            Type = "AppointmentType",
            Start = "StartDate",
            End = "EndDate",
            Subject = "Caption",
            AllDay = "AllDay",
            Location = "Location",
            Description = "Description",
            LabelId = "Label",
            StatusId = "Status",
            RecurrenceInfo = "Recurrence"
        }
    };
    bool IsAppointmentValid(DxSchedulerAppointmentItem appointment) {
        if (appointment.IsRecurring && 
                appointment.RecurrenceInfo.Range == SchedulerRecurrenceRange.OccurrenceCount &&
                appointment.RecurrenceInfo.OccurrenceCount == 1)
            return false;
        return true;
    }

    void AppointmentUpdating(SchedulerAppointmentOperationEventArgs e) {
        if (!IsAppointmentValid(e.Appointment)) {
            e.Cancel = true;
            AlertVisible = true;
            ValidationFailed = true;
        }
    }
    void AppointmentInserting(SchedulerAppointmentOperationEventArgs e) {
        if (!IsAppointmentValid(e.Appointment)) {
            e.Cancel = true;
            AlertVisible = true;
            ValidationFailed = true;
        }
    }
    void AppointmentFormClosing(SchedulerAppointmentFormClosingEventArgs e) {
        if (ValidationFailed) {
            e.Cancel = true;
            ValidationFailed = false;
        }
    }
}

See the DxSchedulerRecurrenceInfo class description for more information and an example.

See Also