seeding the dropdown list without a value

is it possible to select a time in the dropdown list without having a value in the form

we have all 24 hours in the dropdown in 15 minute increment


most times users will select a time after 7am so we would like to default the list when rolled down to 7am but without setting the value of the form to anything





1 Reply

YS Yohapuja Selvakumaran Syncfusion Team November 29, 2024 06:05 AM UTC

Hi Michael Salzlechner,


Thank you for reaching out to us.


We have validated your requirement, and we are happy to inform you that you can achieve this using the following features of the SfTimePicker:


Step: Allows you to define the time interval displayed in the time picker popup.

Min and Max Values: Restrict the selectable time range within the popup.


Code Snippet:

Below is an example implementation for your reference:


 

<SfTimePicker TValue="DateTime?" Step="15" Min='@MinVal' Max='@MaxVal'></SfTimePicker>

 

@code{

    public DateTime MinVal { get; set; } = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 15, 07, 00, 00);

    public DateTime MaxVal { get; set; } = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 15, 17, 30, 00);

}

 

 


We have also created a sample for your reference. Kindly check it out:


Sample:
https://blazorplayground.syncfusion.com/VZVfiirahWpKhKdm


For more details on the SfTimePicker and its properties, please refer to the following API documentation:


API Documentation:


Class SfTimePicker<TValue> - Blazor API Reference | Syncfusion


Class SfTimePicker<TValue> - Blazor API Reference | Syncfusion


Class SfTimePicker<TValue> - Blazor API Reference | Syncfusion



We hope this meets your requirements. Please let us know if you have any further questions or need additional assistance.



Regards,

Yohapuja S


Loader.
Up arrow icon