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

DxDateEditSettings.OutOfRangeNotificationText Property

Specifies the notification message displayed in the scroll picker mode when a user selects a date outside the permitted date range.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v24.2.dll

NuGet Package: DevExpress.Blazor

#Declaration

C#
[DefaultValue(null)]
[Parameter]
public string OutOfRangeNotificationText { get; set; }

#Property Value

Type Default Description
String null

A notification text.

#Remarks

The date editor implements the MinDate and MaxDate properties that specify a range of available dates. In scroll picker mode, the editor shows a notification message each time a user tries to navigate to a date that is outside the range. The default notification text is “The selected date should be between {MinDate} and {MaxDate}“.

To customize notification texts, use the OutOfRangeNotificationText property.

Razor
<DxGrid Data="@employees" EditMode="GridEditMode.EditRow">
    <Columns>
        <DxGridCommandColumn />
        <DxGridDataColumn FieldName="FirstName" />
        <DxGridDataColumn FieldName="LastName" />
        <DxGridDataColumn FieldName="HireDate" >
            <EditSettings>
                <DxDateEditSettings MinDate="@minDate" MaxDate="@maxDate"
                                    PickerDisplayMode="DatePickerDisplayMode.ScrollPicker"
                                    OutOfRangeNotificationText="@currentMonthNotification" />
            </EditSettings>
        </DxGridDataColumn>
        <DxGridDataColumn FieldName="BirthDate" />
        <DxGridDataColumn FieldName="Title" />
    </Columns>
</DxGrid>

@code {
    Employee[]? employees;
    // set minDate to the first day of the current month.
    DateTime minDate = new DateTime(DateTime.Today.Year, DateTime.Today.Month, 1);
    // set maxDate to the last day of the current month.
    DateTime maxDate = new DateTime(DateTime.Today.Year, DateTime.Today.Month, 1).AddMonths(1).AddDays(-1);
    string currentMonthNotification = "Please select a date in the current month (" + 
                                       DateTime.Today.ToString("MMM", CultureInfo.InvariantCulture) + ").";
    protected override async Task OnInitializedAsync() {
        employees = await EmployeeData.GetData();
    }
}

Date Editor Out of Range Dates Notification

To specify the out-of-range notification text at runtime, use the IDateEditSettings.OutOfRangeNotificationText property instead.

See Also