Skip to main content
All docs
V24.1

DxDateRangePicker<T>.StartDateExpression Property

Specifies a lambda expression that identifies the StartDate property’s bound value when the Date Range Picker is placed in the EditForm.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v24.1.dll

NuGet Package: DevExpress.Blazor

Declaration

[Parameter]
public Expression<Func<T>> StartDateExpression { get; set; }

Property Value

Type Description
Expression<Func<T>>

A lambda expression that identifies the bound value.

Remarks

You can add a Date Range Picker to Blazor’s standard EditForm component to validate StartDate and EndDate property values. In this case, StartDateExpression and EndDateExpression properties are used to obtain metadata about the value bound to StartDate and EndDate properties.

You should specify StartDateExpression and EndDateExpression properties if you handle StartDateChanged and EndDateChanged events and cannot use two-way binding.

<DxDateRangePicker StartDate="@modelStartDate" 
                   EndDate="@modelEndDate"
                   StartDateExpression="@(() => modelStartDate)"
                   EndDateExpression="@(() => modelEndDate)"
                   StartDateChanged="@((DateTime newStartDate) => OnStartDateChanged(newStartDate))"
                   EndDateChanged="@((DateTime newEndDate)=> OnEndDateChanged(newEndDate))" />

@code {
    DateTime modelStartDate = DateTime.Today;
    DateTime modelEndDate = DateTime.Today.AddDays(7);

    void OnStartDateChanged(DateTime newStartDate) {
        modelStartDate = newStartDate;
        // your logic
    }

    void OnEndDateChanged(DateTime newEndDate) {
        modelEndDate = newEndDate;
        // your logic
    }
}

StartDateExpression and EndDateExpression properties are set internally if you use the @bind attribute for StartDate and EndDate properties to implement two-way binding.

<DxDateRangePicker @bind-StartDate="@DateTimeStart"
                   @bind-EndDate="@DateTimeEnd">
</DxDateRangePicker>

@code {
    DateTime? DateTimeStart { get; set; } = DateTime.Today;
    DateTime? DateTimeEnd { get; set; } = DateTime.Today.AddDays(7);

    ...
}
See Also