Completed
Last Updated: 09 Dec 2020 16:57 by Brian Norris
Release 2.19.0
IT
Created on: 05 Jun 2020 06:45
Category: Checkbox
Type: Bug Report
2
OnChange fires before value binding

When I click the checkbox, the OnChange event fires with the new value, but the model field is not updated yet.

<TelerikCheckBox Id="myCheckBox"
                 @bind-Value="@isSelected"
                 OnChange="@ChangeHandler">
</TelerikCheckBox>
<label for="myCheckBox">@(isSelected ? "Selected" : "Not selected")</label>

<div class="text-info">
    @Result
</div>


@code {
    private bool isSelected { get; set; }
    private string Result { get; set; } = String.Empty;

    void ChangeHandler(object value)
    {
        Console.WriteLine($"CHECKBOX: the model is now {isSelected} and the handler received {value}");
        Result = $"OnChange event fired with: {value}";
    }
}

 

1 comment
Brian Norris
Posted on: 09 Dec 2020 16:57
This appears to be fixed in v2.20, used with .NET 5, December 9, 2020.