menu

Blazor

  • Code Examples
  • Upgrade Guide
  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Class Presets - Blazor API Reference | Syncfusion

    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
    System.Object
    Presets
    Namespace: Syncfusion.Blazor.Calendars
    Assembly: Syncfusion.Blazor.dll
    Syntax
    public class Presets : Object
    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
    System.DateTime

    A System.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
    System.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
    System.DateTime

    A System.DateTime value representing the start of the range.

    Remarks

    This defines the start date of the preset range.

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