menu

Blazor

  • Code Examples
  • Upgrade Guide
  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Class SfDateRangePicker<TValue> - Blazor API Reference | Syncfusion

    Show / Hide Table of Contents

    Class SfDateRangePicker<TValue>

    The DateRangePicker is a graphical user interface component that allows user to select the date range from the calendar.

    Inheritance
    System.Object
    SfBaseComponent
    SfInputTextBase<TValue>
    CalendarBase<TValue>
    SfDateRangePicker<TValue>
    Implements
    IDateRangePicker
    Inherited Members
    CalendarBase<TValue>.CalendarEditContext
    CalendarBase<TValue>.CalendarMode
    CalendarBase<TValue>.ChangeEvent(EventArgs, Boolean)
    CalendarBase<TValue>.ConvertDateValue(TValue)
    CalendarBase<TValue>.ConvertToGregorian(String, String)
    CalendarBase<TValue>.ConvertToHijri(TValue, String)
    CalendarBase<TValue>.DayHeaderFormat
    CalendarBase<TValue>.Depth
    CalendarBase<TValue>.FirstDayOfWeek
    CalendarBase<TValue>.GetDefaultFormat()
    CalendarBase<TValue>.GetHijriMonthIndex(String, String)
    CalendarBase<TValue>.KeyConfigs
    CalendarBase<TValue>.Max
    CalendarBase<TValue>.Min
    CalendarBase<TValue>.ReplaceMonthName(String, DateTime, String[], String)
    CalendarBase<TValue>.ServerTimezoneOffset
    CalendarBase<TValue>.ShowTodayButton
    CalendarBase<TValue>.Start
    CalendarBase<TValue>.WeekNumber
    CalendarBase<TValue>.WeekRule
    SfBaseComponent.Dispose()
    SfBaseComponent.Dispose(Boolean)
    SfBaseComponent.GetEffectivePlatform()
    SfBaseComponent.GetMainComponentPlatform()
    SfBaseComponent.IsMainLicenseComponent()
    SfBaseComponent.LicenseContext
    SfBaseComponent.OnObservableChange(String, Object, Boolean, NotifyCollectionChangedEventArgs)
    SfBaseComponent.ValidateLicense()
    SfInputTextBase<TValue>._value
    SfInputTextBase<TValue>.APPEND
    SfInputTextBase<TValue>.APPEND_ICON
    SfInputTextBase<TValue>.ARIA_DISABLED
    SfInputTextBase<TValue>.BaseAutocomplete
    SfInputTextBase<TValue>.BaseTabIndex
    SfInputTextBase<TValue>.CLEAR_ICON_HIDE
    SfInputTextBase<TValue>.ClearElement
    SfInputTextBase<TValue>.CLEARICONHIDE
    SfInputTextBase<TValue>.ComponentReference
    SfInputTextBase<TValue>.ContainerAttr
    SfInputTextBase<TValue>.containerAttributes
    SfInputTextBase<TValue>.CONTROL_CONTAINER
    SfInputTextBase<TValue>.CONTROL_OLD_CONTAINER
    SfInputTextBase<TValue>.CssClass
    SfInputTextBase<TValue>.DataId
    SfInputTextBase<TValue>.DECREMENT
    SfInputTextBase<TValue>.DECREMENT_TITLE
    SfInputTextBase<TValue>.DecrementTitle
    SfInputTextBase<TValue>.DISABLE
    SfInputTextBase<TValue>.DISABLE_ICON
    SfInputTextBase<TValue>.DISABLED_ATTR
    SfInputTextBase<TValue>.Enabled
    SfInputTextBase<TValue>.EnablePersistence
    SfInputTextBase<TValue>.EnableRtl
    SfInputTextBase<TValue>.FLOATINPUT
    SfInputTextBase<TValue>.FloatLabel
    SfInputTextBase<TValue>.FLOATLABELBOTTOM
    SfInputTextBase<TValue>.FLOATLABELTOP
    SfInputTextBase<TValue>.FLOATTEXT
    SfInputTextBase<TValue>.GROUP_ICON
    SfInputTextBase<TValue>.ID
    SfInputTextBase<TValue>.INCREMENT
    SfInputTextBase<TValue>.INCREMENT_TITLE
    SfInputTextBase<TValue>.IncrementTitle
    SfInputTextBase<TValue>.INPUT
    SfInputTextBase<TValue>.inputAttr
    SfInputTextBase<TValue>.InputEditContext
    SfInputTextBase<TValue>.INPUTFOCUS
    SfInputTextBase<TValue>.INPUTGROUP
    SfInputTextBase<TValue>.IsClearButtonClicked
    SfInputTextBase<TValue>.IsFocused
    SfInputTextBase<TValue>.ListOfButtons
    SfInputTextBase<TValue>.MULTILINE
    SfInputTextBase<TValue>.MultilineInput
    SfInputTextBase<TValue>.OnAfterRenderAsync(Boolean)
    SfInputTextBase<TValue>.OnChangeHandler(ChangeEventArgs)
    SfInputTextBase<TValue>.OnInitializedAsync()
    SfInputTextBase<TValue>.OnInputHandler(ChangeEventArgs)
    SfInputTextBase<TValue>.OnParametersSetAsync()
    SfInputTextBase<TValue>.OnPasteHandler(ClipboardEventArgs)
    SfInputTextBase<TValue>.PREPEND
    SfInputTextBase<TValue>.PREPEND_ICON
    SfInputTextBase<TValue>.SetEnabled()
    SfInputTextBase<TValue>.SPACE
    SfInputTextBase<TValue>.SPIN_DOWN
    SfInputTextBase<TValue>.SPIN_UP
    SfInputTextBase<TValue>.ValidateOnInput
    SfInputTextBase<TValue>.WireClearBtnEvents()
    Syncfusion.Blazor.Calendars.CalendarBase<TValue>.CurrentCulture
    Syncfusion.Blazor.Calendars.CalendarBase<TValue>.IsDateOnlyType()
    Syncfusion.Blazor.Calendars.CalendarBase<TValue>.IsDateTimeOffsetType()
    Syncfusion.Blazor.Calendars.CalendarBase<TValue>.SetParametersAsync(Microsoft.AspNetCore.Components.ParameterView)
    Syncfusion.Blazor.Inputs.SfInputTextBase<TValue>.BlurHandler(System.String, System.Boolean)
    Syncfusion.Blazor.Inputs.SfInputTextBase<TValue>.ClickStopPropagation
    Syncfusion.Blazor.Inputs.SfInputTextBase<TValue>.ContainerClass
    Syncfusion.Blazor.Inputs.SfInputTextBase<TValue>.IsValueTemplate
    Syncfusion.Blazor.Inputs.SfInputTextBase<TValue>.MouseDowSpinnerPrevent
    Syncfusion.Blazor.Inputs.SfInputTextBase<TValue>.MousePreventContainer
    Syncfusion.Blazor.Inputs.SfInputTextBase<TValue>.OnBlur
    Syncfusion.Blazor.Inputs.SfInputTextBase<TValue>.OnChange
    Syncfusion.Blazor.Inputs.SfInputTextBase<TValue>.OnFocus
    Syncfusion.Blazor.Inputs.SfInputTextBase<TValue>.OnInput
    Syncfusion.Blazor.Inputs.SfInputTextBase<TValue>.OnPaste
    Syncfusion.Blazor.Inputs.SfInputTextBase<TValue>.PreventIconHandler
    Syncfusion.Blazor.Inputs.SfInputTextBase<TValue>.SpinButton
    Syncfusion.Blazor.Inputs.SfInputTextBase<TValue>.ValueTemplate
    Namespace: Syncfusion.Blazor.Calendars
    Assembly: Syncfusion.Blazor.dll
    Syntax
    public class SfDateRangePicker<TValue> : CalendarBase<TValue>, IDateRangePicker
    Type Parameters
    Name Description
    TValue

    Specifies the type of SfDateRangePicker<TValue>.

    Remarks

    The DateRangePicker component supports various date formats, localization, validation, and preset date ranges. It provides a popup calendar interface for easy date selection and supports both manual input and calendar-based selection. The component inherits from CalendarBase<T> and implements IDateRangePicker.

    Examples
    <SfDateRangePicker TValue="DateTime?" Placeholder="Select a Range"></SfDateRangePicker>

    The following example demonstrates how to create a basic DateRangePicker component.

    <SfDateRangePicker TValue="DateTime" StartDate="DateTime.Now" EndDate="DateTime.Now.AddDays(7)" />

    Constructors

    SfDateRangePicker()

    Declaration
    public SfDateRangePicker()

    Properties

    AllowEdit

    Gets or sets a value indicating whether the user can change the value by typing. When set to false, the value can only be changed via the picker.

    Declaration
    public bool AllowEdit { get; set; }
    Property Value
    Type Description
    System.Boolean

    true if the DateRangePicker value can be edited, otherwise false. The default value is true.

    Remarks

    Set this property to false to prevent users from typing in the input field.

    Examples
    <SfDateRangePicker TValue="DateTime?" AllowEdit="false"></SfDateRangePicker>

    BaseFloatLabelType

    Declaration
    protected override FloatLabelType BaseFloatLabelType { get; set; }
    Property Value
    Type
    FloatLabelType
    Overrides
    Syncfusion.Blazor.Inputs.SfInputTextBase<TValue>.BaseFloatLabelType

    BaseHtmlAttributes

    Declaration
    protected override Dictionary<string, object> BaseHtmlAttributes { get; set; }
    Property Value
    Type
    System.Collections.Generic.Dictionary<System.String, System.Object>
    Overrides
    Syncfusion.Blazor.Inputs.SfInputTextBase<TValue>.BaseHtmlAttributes

    BaseInputAttributes

    Declaration
    protected override Dictionary<string, object> BaseInputAttributes { get; set; }
    Property Value
    Type
    System.Collections.Generic.Dictionary<System.String, System.Object>
    Overrides
    Syncfusion.Blazor.Inputs.SfInputTextBase<TValue>.BaseInputAttributes

    BaseIsReadOnlyInput

    Declaration
    protected override bool BaseIsReadOnlyInput { get; set; }
    Property Value
    Type
    System.Boolean
    Overrides
    Syncfusion.Blazor.Inputs.SfInputTextBase<TValue>.BaseIsReadOnlyInput

    BasePlaceholder

    Declaration
    protected override string BasePlaceholder { get; set; }
    Property Value
    Type
    System.String
    Overrides
    Syncfusion.Blazor.Inputs.SfInputTextBase<TValue>.BasePlaceholder

    BaseReadonly

    Declaration
    protected override bool BaseReadonly { get; set; }
    Property Value
    Type
    System.Boolean
    Overrides
    Syncfusion.Blazor.Inputs.SfInputTextBase<TValue>.BaseReadonly

    BaseShowClearButton

    Declaration
    protected override bool BaseShowClearButton { get; set; }
    Property Value
    Type
    System.Boolean
    Overrides
    Syncfusion.Blazor.Inputs.SfInputTextBase<TValue>.BaseShowClearButton

    BaseWidth

    Declaration
    protected override string BaseWidth { get; set; }
    Property Value
    Type
    System.String
    Overrides
    Syncfusion.Blazor.Inputs.SfInputTextBase<TValue>.BaseWidth

    EndDate

    Gets or sets the end date of the date range selection.

    Declaration
    public TValue EndDate { get; set; }
    Property Value
    Type Description
    TValue

    The end date of the date range selection.

    Remarks

    This property can be used for two-way binding.

    Examples
    <SfDateRangePicker @bind-EndDate="EndDateValue" TValue="DateTime?"></SfDateRangePicker>
    
    @code {
       public DateTime? EndDateValue { get; set; } = new DateTime(2023, 1, 20);
    }

    EndDateChanged

    Triggers when the end date of the DateRangePicker is changed.

    Declaration
    public EventCallback<TValue> EndDateChanged { get; set; }
    Property Value
    Type
    Microsoft.AspNetCore.Components.EventCallback<TValue>
    Remarks

    This event can be used to perform actions when the end date is changed.

    Examples
    <SfDateRangePicker TValue="DateTime?">
        <DateRangePickerEvents TValue="DateTime?" EndDateChanged="@EndDateChangedHandler"></DateRangePickerEvents>
    </SfDateRangePicker>
    
    @code {
        public void EndDateChangedHandler(DateTime? args)
        {
            // Your logic here
        }
    }

    EndDateExpression

    Gets or sets the expression for defining the end date of the bound.

    Declaration
    public Expression<Func<TValue>> EndDateExpression { get; set; }
    Property Value
    Type Description
    System.Linq.Expressions.Expression<System.Func<TValue>>

    An expression that defines the end date of the bound.

    Remarks

    This property is used to bind a specific field of a model class to the EndDate of the DateRangePicker.

    Examples
    <SfDateRangePicker @bind-StartDate="StartDateValue" @bind-EndDate="EndDateValue" TValue="DateTime?"></SfDateRangePicker>
    
    @code {
       public DateTime? StartDateValue { get; set; } = new DateTime(2023, 1, 10);
       public DateTime? EndDateValue { get; set; } = new DateTime(2023, 1, 20);
    }

    FloatLabelType

    Gets or sets the floating label behavior of the DateRangePicker that the placeholder text floats above the DateRangePicker based on the following values.

    Declaration
    public FloatLabelType FloatLabelType { get; set; }
    Property Value
    Type Description
    FloatLabelType

    The floating label behavior of the DateRangePicker. The possible values are:

    • NeverThe label never floats.
    • AlwaysThe label always floats.
    • AutoThe label floats when the input is focused or has a value.
    Remarks

    This property determines how the placeholder text interacts with the input field.

    Examples
    <SfDateRangePicker TValue="DateTime?" FloatLabelType="FloatLabelType.Always" Placeholder="Select a Date Range"></SfDateRangePicker>

    Format

    Gets or sets the format for the start and end date strings.

    Declaration
    public string Format { get; set; }
    Property Value
    Type Description
    System.String

    A string that specifies the date format. The default format is based on the culture.

    Remarks

    You can set formats like "dd/MM/yyyy hh:mm". By default, the format is culture-dependent, e.g., "M/d/yyyy" for en-US.

    Examples
    <SfDateRangePicker TValue="DateTime?" Format="yyyy-MM-dd"></SfDateRangePicker>

    FullScreen

    Gets or sets a boolean value that indicates whether to enable a full-screen layout for the DateRangePicker component popup in mobile devices.

    Declaration
    public bool FullScreen { get; set; }
    Property Value
    Type Description
    System.Boolean

    true to enable a full-screen layout for the popup on mobile devices; otherwise, false. The default value is false.

    Remarks

    The FullScreen property is applicable for mobile and tablet devices only.

    Examples
    <SfDateRangePicker TValue="DateTime?" FullScreen="true"></SfDateRangePicker>

    HtmlAttributes

    Gets or sets additional HTML attributes such as styles, class, and more to the root element.

    Declaration
    public Dictionary<string, object> HtmlAttributes { get; set; }
    Property Value
    Type Description
    System.Collections.Generic.Dictionary<System.String, System.Object>

    A dictionary of additional HTML attributes for the root element of the DateRangePicker.

    Remarks

    If you have configured both this property and an equivalent HTML attribute, the component will prioritize the property value.

    Examples
    <SfDateRangePicker TValue="DateTime?" HtmlAttributes="@(new Dictionary<string, object>() { { "class", "custom-class" } })"></SfDateRangePicker>

    InputAttributes

    Gets or sets additional input attributes such as disabled, value, and more to the root element.

    Declaration
    public Dictionary<string, object> InputAttributes { get; set; }
    Property Value
    Type Description
    System.Collections.Generic.Dictionary<System.String, System.Object>

    A dictionary containing additional input attributes that can be added to the root element, such as disabled or value.

    Remarks

    If you have configured both this property and an equivalent input attribute, the component will prioritize the property value.

    Examples
    <SfDateRangePicker TValue="DateTime?" InputAttributes="@(new Dictionary<string, object>() { { "aria-label", "date range picker" } })"></SfDateRangePicker>

    InputFormats

    Gets or sets an array of input formats to be used for parsing date values in the SfDateRangePicker<TValue> component.

    Declaration
    public string[] InputFormats { get; set; }
    Property Value
    Type Description
    System.String[]

    An array of strings representing the acceptable input formats for date values. The default value is null.

    Remarks

    This property allows the SfDateRangePicker<TValue> to interpret typed date values using a specified array of formats.
    The formats can include both standard and custom formats supported in C#. When both InputFormats and Format properties are specified, the InputFormats property takes priority. If only InputFormats is specified, parsing will be attempted using the formats provided in the array.
    If neither property is specified, the default behavior remains unchanged.
    The parsing logic prioritizes the formats in the order they are specified in the InputFormats array.
    If a successful parsing occurs, the SfDateRangePicker<TValue> updates its value accordingly. Error handling is controlled by the StrictMode property, allowing for different user experiences in case of invalid input.

    Examples

    The following example demonstrates how to set the InputFormats property to accept multiple date formats:

    <SfDateRangePicker InputFormats='new string[] { "dd/MM/yyyy", "MM/dd/yyyy", "yyyy-MM-dd" }' TValue="DateTime?" />

    MaxDays

    Gets or sets the maximum number of days that can be selected in a date range.

    Declaration
    public Nullable<int> MaxDays { get; set; }
    Property Value
    Type Description
    System.Nullable<System.Int32>

    An integer representing the maximum span of days allowed in a date range selection.

    Remarks

    This property helps enforce limits on the duration of the selected date range.

    Examples
    <SfDateRangePicker TValue="DateTime?" MaxDays="10"></SfDateRangePicker>

    MinDays

    Gets or sets the minimum number of days that can be selected in a date range.

    Declaration
    public Nullable<int> MinDays { get; set; }
    Property Value
    Type Description
    System.Nullable<System.Int32>

    An integer representing the minimum span of days allowed in a date range selection.

    Remarks

    This property helps enforce a minimum duration for the selected date range.

    Examples
    <SfDateRangePicker TValue="DateTime?" MinDays="3"></SfDateRangePicker>

    OpenOnFocus

    Gets or sets a value indicating whether the DateRangePicker popup opens automatically when the input field receives focus.

    Declaration
    public bool OpenOnFocus { get; set; }
    Property Value
    Type Description
    System.Boolean

    true if the DateRangePicker popup should open on input focus; otherwise, false. The default is false.

    Remarks

    Use this property to improve user experience by automatically showing the DateRangePicker popup when the user clicks or tabs into the input field. This is particularly useful for interfaces where quick access to date selection is desirable.

    Examples
    <SfDateRangePicker OpenOnFocus="true" TValue="DateTime?" ></SfDateRangePicker>

    Placeholder

    Gets or sets the text that is shown as a hint or placeholder until the user focuses or enters a value in the DateRangePicker.

    Declaration
    public string Placeholder { get; set; }
    Property Value
    Type Description
    System.String

    A string that will be displayed as a placeholder.

    Remarks

    The behavior of this property depends on the FloatLabelType property.

    Examples
    <SfDateRangePicker TValue="DateTime?" Placeholder="Select a date range"></SfDateRangePicker>

    Presets

    Gets or sets the list of presets for the DateRangePicker popup.

    Declaration
    public List<Presets> Presets { get; set; }
    Property Value
    Type Description
    System.Collections.Generic.List<Presets>

    A list of Presets objects. The default value is an empty list.

    Remarks

    Presets provide predefined date ranges that users can select.

    Examples
    <SfDateRangePicker TValue="DateTime?">
        <DateRangePickerPresets>
            <Preset Label="Today" Start="DateTime.Now.Date" End="DateTime.Now.Date"></Preset>
        </DateRangePickerPresets>
    </SfDateRangePicker>

    Readonly

    Gets or sets a value indicating whether the DateRangePicker is in a read-only state.

    Declaration
    public bool Readonly { get; set; }
    Property Value
    Type Description
    System.Boolean

    true if the DateRangePicker is read-only; otherwise, false. The default is false.

    Remarks

    When this property is set to true, the user cannot change the value.

    Examples
    <SfDateRangePicker TValue="DateTime?" Readonly="true"></SfDateRangePicker>

    RootClass

    Declaration
    protected override string RootClass { get; set; }
    Property Value
    Type
    System.String
    Overrides
    Syncfusion.Blazor.Inputs.SfInputTextBase<TValue>.RootClass

    Separator

    Gets or sets the string that separates the start and end date strings.

    Declaration
    public string Separator { get; set; }
    Property Value
    Type Description
    System.String

    A string used as a separator. The default value is "-".

    Remarks

    This string is displayed between the start and end dates in the input field.

    Examples
    <SfDateRangePicker TValue="DateTime?" Separator="to"></SfDateRangePicker>

    ShowClearButton

    Gets or sets a value indicating whether to show the clear icon in the DateRangePicker.

    Declaration
    public bool ShowClearButton { get; set; }
    Property Value
    Type Description
    System.Boolean

    true to show the clear icon; otherwise, false. The default value is true.

    Remarks

    The clear icon allows users to easily clear the selected date range.

    Examples
    <SfDateRangePicker TValue="DateTime?" ShowClearButton="true"></SfDateRangePicker>

    StartDate

    Gets or sets the start date of the date range selection.

    Declaration
    public TValue StartDate { get; set; }
    Property Value
    Type Description
    TValue

    Accepts the start date of the date range selection, represented as a value of type TValue.

    Remarks

    This property can be used for two-way binding.

    Examples
    <SfDateRangePicker @bind-StartDate="StartDateValue" TValue="DateTime?"></SfDateRangePicker>
    
    @code {
       public DateTime? StartDateValue { get; set; } = new DateTime(2023, 1, 10);
    }

    StartDateExpression

    Gets or sets the expression for defining the start date of the bound.

    Declaration
    public Expression<Func<TValue>> StartDateExpression { get; set; }
    Property Value
    Type Description
    System.Linq.Expressions.Expression<System.Func<TValue>>

    An expression that defines the start date of the bound.

    Remarks

    This property is used to bind a specific field of a model class to the StartDate of the DateRangePicker.

    Examples
    <SfDateRangePicker @bind-StartDate="StartDateValue" @bind-EndDate="EndDateValue" TValue="DateTime?"></SfDateRangePicker>
    
    @code {
       public DateTime? StartDateValue { get; set; } = new DateTime(2023, 1, 10);
       public DateTime? EndDateValue { get; set; } = new DateTime(2023, 1, 20);
    }

    StrictMode

    Gets or sets a value indicating whether the DateRangePicker should operate in strict mode.

    Declaration
    public bool StrictMode { get; set; }
    Property Value
    Type Description
    System.Boolean

    true to prevent entering an invalid date; otherwise, false to allow invalid or out-of-range values with a highlighted error class. The default is false.

    Remarks

    When in strict mode, only valid date values within the specified range are allowed, and any invalid input will be reset to the previous value.

    Examples
    <SfDateRangePicker TValue="DateTime?" StrictMode="true"></SfDateRangePicker>

    Value

    Gets or sets the selected date of the Calendar.

    Declaration
    public object Value { get; set; }
    Property Value
    Type Description
    System.Object

    Accepts the selected date of calendar.

    Remarks

    For the DateRangePicker, this property is not the primary way to set the selected range. Use StartDate and EndDate instead.

    ValueChanged

    Specifies the callback to trigger when the value changes.

    Declaration
    public EventCallback<object> ValueChanged { get; set; }
    Property Value
    Type
    Microsoft.AspNetCore.Components.EventCallback<System.Object>
    Remarks

    For the DateRangePicker, this event is not the primary way to handle value changes. Use Syncfusion.Blazor.Calendars.SfDateRangePicker`1.StartDateChanged and EndDateChanged instead.

    ValueExpression

    Gets or sets the expression for defining the value of the bound.

    Declaration
    public Expression<Func<object>> ValueExpression { get; set; }
    Property Value
    Type Description
    System.Linq.Expressions.Expression<System.Func<System.Object>>

    An expression that defines the value of the bound.

    Remarks

    This property is not typically used for the DateRangePicker. Use StartDateExpression and EndDateExpression instead.

    Width

    Gets or sets the width of the DateRangePicker component.

    Declaration
    public string Width { get; set; }
    Property Value
    Type Description
    System.String

    A string that defines the width.

    Remarks

    The width can be specified in pixels or percentages.

    Examples
    <SfDateRangePicker TValue="DateTime?" Width="250px"></SfDateRangePicker>

    ZIndex

    Gets or sets the z-index value of the DateRangePicker popup element.

    Declaration
    public int ZIndex { get; set; }
    Property Value
    Type Description
    System.Int32

    An integer that specifies the z-index. The default value is 1000.

    Remarks

    This property is useful for controlling the stacking order of the popup element.

    Examples
    <SfDateRangePicker TValue="DateTime?" ZIndex="1200"></SfDateRangePicker>

    Methods

    BuildRenderTree(RenderTreeBuilder)

    Declaration
    protected override void BuildRenderTree(RenderTreeBuilder __builder)
    Parameters
    Type Name Description
    Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder

    ChangeHandler(ChangeEventArgs)

    Handles change events when the DateRangePicker input value changes.

    Declaration
    protected override Task ChangeHandler(ChangeEventArgs args)
    Parameters
    Type Name Description
    Microsoft.AspNetCore.Components.ChangeEventArgs args

    The Microsoft.AspNetCore.Components.ChangeEventArgs containing the change event information.

    Returns
    Type Description
    System.Threading.Tasks.Task

    A System.Threading.Tasks.Task representing the asynchronous operation.

    Overrides
    Syncfusion.Blazor.Inputs.SfInputTextBase<TValue>.ChangeHandler(Microsoft.AspNetCore.Components.ChangeEventArgs)
    Remarks

    This method processes value changes from user input or programmatic updates, excluding clear operations. It updates the current value string to reflect the new input state.

    CurrentView()

    Gets the current view of the calendar.

    Declaration
    public string CurrentView()
    Returns
    Type Description
    System.String

    A string representing the current view of the calendar, such as "Month", "Year", or "Decade".

    Remarks

    This method returns the name of the current view being displayed in the calendar. For example, if the calendar is showing the monthly view, it will return "Month".

    FocusAsync()

    Sets focus on the DateRangePicker component for interaction.

    Declaration
    public Task FocusAsync()
    Returns
    Type Description
    System.Threading.Tasks.Task

    A System.Threading.Tasks.Task that represents the asynchronous operation.

    Remarks

    This method allows you to programmatically focus on the DateRangePicker, enabling user interaction and input.

    FocusHandler(FocusEventArgs)

    Handles the focus event when the DateRangePicker input receives focus.

    Declaration
    protected override Task FocusHandler(FocusEventArgs args)
    Parameters
    Type Name Description
    Microsoft.AspNetCore.Components.Web.FocusEventArgs args

    The FocusEventArgs containing focus event information.

    Returns
    Type Description
    System.Threading.Tasks.Task

    A System.Threading.Tasks.Task representing the asynchronous operation.

    Overrides
    Syncfusion.Blazor.Inputs.SfInputTextBase<TValue>.FocusHandler(Microsoft.AspNetCore.Components.Web.FocusEventArgs)
    Remarks

    This method triggers focus-related actions such as invoking focus event handlers, adjusting float label behavior, and optionally opening the popup if OpenOnFocus is enabled. It ensures proper focus management and user experience.

    FocusOutAsync()

    Removes focus from the DateRangePicker component if it is in a focused state.

    Declaration
    public Task FocusOutAsync()
    Returns
    Type Description
    System.Threading.Tasks.Task

    A System.Threading.Tasks.Task that represents the asynchronous operation.

    Remarks

    This method is used to programmatically remove focus from the DateRangePicker, which can be useful for managing user input flow.

    FocusOutHandler(FocusEventArgs)

    Handles the blur event when the DateRangePicker input loses focus.

    Declaration
    protected override Task FocusOutHandler(FocusEventArgs args)
    Parameters
    Type Name Description
    Microsoft.AspNetCore.Components.Web.FocusEventArgs args

    The FocusEventArgs containing focus event information.

    Returns
    Type Description
    System.Threading.Tasks.Task

    A System.Threading.Tasks.Task representing the asynchronous operation.

    Overrides
    Syncfusion.Blazor.Inputs.SfInputTextBase<TValue>.FocusOutHandler(Microsoft.AspNetCore.Components.Web.FocusEventArgs)
    Remarks

    This method processes focus out events by validating input values, updating component state, adjusting visual elements, and triggering blur event handlers. It ensures data integrity when the user navigates away from the input.

    FormatValue(String)

    Formats and validates the input string value into the appropriate date range format.

    Declaration
    protected override TValue FormatValue(string genericValue = null)
    Parameters
    Type Name Description
    System.String genericValue

    The string value to format and validate. If null, uses the component's current input value.

    Returns
    Type Description
    TValue

    The default value of type TValue, as this method updates internal properties rather than returning a formatted value.

    Overrides
    Syncfusion.Blazor.Inputs.SfInputTextBase<TValue>.FormatValue(System.String)
    Remarks

    This method parses the input string to extract start and end date values, validates them against the component's constraints, and updates the internal StartValue and EndValue properties accordingly.

    FormatValueAsString(TValue)

    Formats the specified date range value as a string representation.

    Declaration
    protected override string FormatValueAsString(TValue formatValue)
    Parameters
    Type Name Description
    TValue formatValue

    The date range value to format. This parameter is not directly used as the method formats the current StartDate and EndDate values.

    Returns
    Type Description
    System.String

    A System.String representing the formatted date range, or the current formatted date value, or default if no valid range exists.

    Overrides
    Syncfusion.Blazor.Inputs.SfInputTextBase<TValue>.FormatValueAsString(TValue)
    Remarks

    This method converts the current date range (StartDate and EndDate) into a string format suitable for display. The formatting follows the component's configured format pattern and separator settings.

    GetPersistData()

    Gets the properties to be maintained in the persisted state.

    Declaration
    public Task<string> GetPersistData()
    Returns
    Type Description
    System.Threading.Tasks.Task<System.String>

    A System.Threading.Tasks.Task that represents the asynchronous operation. The task result contains a string with the persisted data.

    Remarks

    This method retrieves component data that has been persisted in local storage, which is useful for maintaining state across page loads.

    HidePopupAsync()

    Hides the calendar popup.

    Declaration
    public Task HidePopupAsync()
    Returns
    Type Description
    System.Threading.Tasks.Task

    A System.Threading.Tasks.Task that represents the asynchronous operation.

    Remarks

    This method programmatically closes the DateRangePicker's calendar popup if it is currently visible.

    InputHandler(ChangeEventArgs)

    Handles input events when the user types in the DateRangePicker input field.

    Declaration
    protected override Task InputHandler(ChangeEventArgs args)
    Parameters
    Type Name Description
    Microsoft.AspNetCore.Components.ChangeEventArgs args

    The Microsoft.AspNetCore.Components.ChangeEventArgs containing the input change information.

    Returns
    Type Description
    System.Threading.Tasks.Task

    A System.Threading.Tasks.Task representing the asynchronous operation.

    Overrides
    Syncfusion.Blazor.Inputs.SfInputTextBase<TValue>.InputHandler(Microsoft.AspNetCore.Components.ChangeEventArgs)
    Remarks

    This method processes real-time input changes, validates the input if ValidateOnInput is enabled, and updates the component's internal state. It provides immediate feedback during user input.

    ShowPopupAsync()

    Opens the popup to display the calendar.

    Declaration
    public Task ShowPopupAsync()
    Returns
    Type Description
    System.Threading.Tasks.Task

    A System.Threading.Tasks.Task that represents the asynchronous operation.

    Remarks

    This method programmatically opens the DateRangePicker's calendar popup, allowing the user to select a date range. It will not open if the component is disabled or read-only.

    UpdateChildProperties(Object)

    Updates the child properties of the DateRangePicker component with the specified preset values.

    Declaration
    public void UpdateChildProperties(object presetValue)
    Parameters
    Type Name Description
    System.Object presetValue

    An object containing the preset values to be applied to the component. Expected to be of type System.Collections.Generic.List<>.

    Remarks

    This method converts the provided preset values into the appropriate format and updates the component's preset properties. The preset values allow users to quickly select commonly used date ranges such as "Last 7 days", "This month", etc.

    Exceptions
    Type Condition
    System.InvalidCastException

    Thrown when the presetValue parameter cannot be cast to the expected type.

    UpdateHeaders()

    Updates the header properties of the DateRangePicker popup to display the current start date, end date, and selected range information.

    Declaration
    public void UpdateHeaders()
    Remarks

    This method refreshes the popup header to show formatted start and end dates along with the number of days in the selected range. The header displays localized text for start date, end date, and range duration based on the component's locale settings. If no dates are selected, appropriate placeholder text is displayed instead.

    Implements

    IDateRangePicker
    Back to top Generated by DocFX
    Copyright © 2001 - 2025 Syncfusion Inc. All Rights Reserved