Unplanned
Last Updated: 05 Jun 2020 06:46 by ADMIN
IT
Created on: 05 Jun 2020 06:45
Category: Checkbox
Type: Bug Report
1
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}";
    }
}

 

0 comments