alexa
menu

Blazor

  • Code Examples
  • Upgrade Guide
  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Search Results for

    Show / Hide Table of Contents

    Class Presets

    Defines a preset date range with a label, start date, and end date for the SfDateRangePicker<TValue>.

    Inheritance
    object
    Presets
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: Syncfusion.Blazor.Calendars
    Assembly: Syncfusion.Blazor.dll
    Syntax
    public class Presets
    Remarks

    Presets allow users to quickly select predefined date ranges.

    Examples
    <SfDateRangePicker TValue="DateTime?">
        <DateRangePickerPresets>
            <Preset Label="This Week" Start="DateTime.Now.AddDays(-(int)DateTime.Now.DayOfWeek)" End="DateTime.Now.AddDays(6 - (int)DateTime.Now.DayOfWeek)"></Preset>
            <Preset Label="This Month" Start="new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1)" End="new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1).AddMonths(1).AddDays(-1)"></Preset>
            <Preset Label="Last Month" Start="new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1).AddMonths(-1)" End="new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1).AddDays(-1)"></Preset>
            <Preset Label="This Year" Start="new DateTime(DateTime.Now.Year, 1, 1)" End="new DateTime(DateTime.Now.Year, 12, 31)"></Preset>
        </DateRangePickerPresets>
    </SfDateRangePicker>

    Constructors

    Presets()

    Declaration
    public Presets()

    Properties

    End

    Gets or sets the end date of the preset range.

    Declaration
    public DateTime End { get; set; }
    Property Value
    Type Description
    DateTime

    A DateTime value representing the end of the range.

    Remarks

    This defines the end date of the preset range.

    Label

    Gets or sets the label for the preset range.

    Declaration
    public string Label { get; set; }
    Property Value
    Type Description
    string

    A string that represents the label for the preset range.

    Remarks

    The label is displayed in the list of presets for the user to select.

    Start

    Gets or sets the start date of the preset range.

    Declaration
    public DateTime Start { get; set; }
    Property Value
    Type Description
    DateTime

    A DateTime value representing the start of the range.

    Remarks

    This defines the start date of the preset range.

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