RadzenDatePicker ... click outside the popup for time, value is not RESET #1685

Closed
opened 2026-01-29 17:57:14 +00:00 by claunia · 3 comments
Owner

Originally created by @bc3 on GitHub (Mar 27, 2025).

Describe the bug

We have a RadzenDatePicker with the option TimeOnly

<RadzenDatePicker TValue="DateTime?"
                  @bind-Value="@Value"
                  ShowTime="true"
                  TimeOnly="true"
                  DateFormat="HH:mm"
                  Change="@OnChangeInner"
                  ReadOnly="false"
                  Style="width:100%" 
                  AllowClear="true"/>

bound to a value

public DateTime? Value { get; set; }

and with a change event

private void OnChangeInner(DateTime? obj)
{
    Value = obj;
    Console.WriteLine(obj);
}

Now when you click outside the OK box , the value is not reset, and the change event is not triggered!

You can see this in this movie below

To Reproduce
Steps to reproduce the behavior:

  1. Make a RadzenDateTimePicker
  2. Add the binding and the event
  3. Run
  4. Enter a value
  5. Enter another value and click outside the box
  6. You can see that the OnChangeInner is not called, and the value in the input is not reset

Alternatively link your repo with a sample project that can be run.

https://github.com/bc3/BlazorDemos (demo project)

Expected behavior
The value in the box is reset, and not updated

Screenshots
Movie
https://github.com/user-attachments/assets/d8e0a585-0472-4d73-bec9-f7f3dce2c040

Desktop (please complete the following information):

  • OS: MacOs Sequoia 15.3.2
  • Browser: Google Chrome
  • Version: latest
Originally created by @bc3 on GitHub (Mar 27, 2025). **Describe the bug** We have a RadzenDatePicker with the option TimeOnly ``` <RadzenDatePicker TValue="DateTime?" @bind-Value="@Value" ShowTime="true" TimeOnly="true" DateFormat="HH:mm" Change="@OnChangeInner" ReadOnly="false" Style="width:100%" AllowClear="true"/> ``` bound to a value `public DateTime? Value { get; set; }` and with a change event ``` private void OnChangeInner(DateTime? obj) { Value = obj; Console.WriteLine(obj); } ``` Now when you click outside the OK box , the value is not reset, and the change event is not triggered! You can see this in this movie below **To Reproduce** Steps to reproduce the behavior: 1. Make a RadzenDateTimePicker 2. Add the binding and the event 3. Run 4. Enter a value 5. Enter another value and click outside the box 6. You can see that the OnChangeInner is not called, and the value in the input is not reset Alternatively link your repo with a sample project that can be run. https://github.com/bc3/BlazorDemos (demo project) **Expected behavior** The value in the box is reset, and not updated **Screenshots** Movie https://github.com/user-attachments/assets/d8e0a585-0472-4d73-bec9-f7f3dce2c040 **Desktop (please complete the following information):** - OS: MacOs Sequoia 15.3.2 - Browser: Google Chrome - Version: latest
Author
Owner

@enchev commented on GitHub (Mar 27, 2025):

You can set ShowTimeOkButton="false" AllowClear="true" and additionally handle Change event to set desired value when cleared if you do not want null. Use our forum in the future for such questions.

@enchev commented on GitHub (Mar 27, 2025): You can set ShowTimeOkButton="false" AllowClear="true" and additionally handle Change event to set desired value when cleared if you do not want null. Use our forum in the future for such questions.
Author
Owner

@bc3 commented on GitHub (Mar 27, 2025):

@enchev we will check with business if that is possible. We have an autosave feature in our application, and like this it would autosave every click, that's why we would like to use the OK button.

Is there a possible solution with the OK button ? because now i see in code when you change the values in the popup , it also changes the value of the original input. And you could rewrite it that it keeps a state, and only update the value in the input when you click the OK button ?

@bc3 commented on GitHub (Mar 27, 2025): @enchev we will check with business if that is possible. We have an autosave feature in our application, and like this it would autosave every click, that's why we would like to use the OK button. Is there a possible solution with the OK button ? because now i see in code when you change the values in the popup , it also changes the value of the original input. And you could rewrite it that it keeps a state, and only update the value in the input when you click the OK button ?
Author
Owner

@enchev commented on GitHub (Mar 27, 2025):

The bound value is updated immediately since you are using two-way binding with @bind-Value expression. Again, use the forum for such discussions.

@enchev commented on GitHub (Mar 27, 2025): The bound value is updated immediately since you are using two-way binding with @bind-Value expression. Again, use the forum for such discussions.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/radzen-blazor#1685