DateTimePicker OnValueChange does not fire

Hello,

I wanted to include the SfDateTimePicker in my project and included first the example from your documentation at Data-Binding. Unfortunately, even if I copied your code it didn't work

Here is the component (code pasted from your documentation)




When I change the DateTimePickerValue the breakpoint won't be reached. Even a Console.WriteLine("Test") is not printed (That was another try because I first thought I only have problems with the debugger).

I use

- Syncfusion.Blazor.Themes 19.4.0.56
- Syncfusion.Blazor.19.4.0.56
- Blazor Server on .NET 6.0

And I included the Stylesheet and js file in _Host.cshtml:

<link rel='nofollow' href="_content/Syncfusion.Blazor.Themes/bootstrap5.css" rel="stylesheet" />

<script src="https://cdn.syncfusion.com/blazor/19.4.48/syncfusion-blazor.min.js" type="text/javascript"></script>

I hope you can help me.

Looking forward to hearing from you

Kind regards

Nick



3 Replies 1 reply marked as answer

PM Ponmani Murugaiyan Syncfusion Team March 31, 2022 05:31 AM UTC

Hi Nick,


The cause for the issue is DatePicker events tag used in the provided code snippet. But DateTimePicker component should use the DateTimePicker events tag as like below code snippet. We will resolve this issue in our online documentation soon in our end.


Sample: https://www.syncfusion.com/downloads/support/directtrac/general/ze/DatePicker2021551773


<SfDateTimePicker TValue="DateTime?" Value="@DateValue">

    <DateTimePickerEvents TValue="DateTime?" ValueChange="@onChange"></DateTimePickerEvents>

</SfDateTimePicker>

 

@code {

 

    public DateTime? DateValue { get; set; } = DateTime.Now;

 

    private void onChange(Syncfusion.Blazor.Calendars.ChangedEventArgs<DateTime?> args)

    {

        DateValue = args.Value;

        StateHasChanged();

    }

}


Regards,

Ponmani M


Marked as answer

NI Nick replied to Ponmani Murugaiyan March 31, 2022 08:27 AM UTC

Thank you - That was the solution :)



PM Ponmani Murugaiyan Syncfusion Team April 1, 2022 04:05 AM UTC

Hi Nick,


We are glad to hear that the issue has been resolved.


Regards,

Ponmani M


Loader.
Up arrow icon