We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Checkbox not getting the correct value

Hello,

We have a component that uses the EjsCheckBox and sets it like this 

<EjsCheckBox @bind-Checked="Value"
                         Label="@Label"></EjsCheckBox>


The value comes from a parameter:

    private bool _value;
    [Parameter]
    public bool Value
    {
        get => _value;
        set
        {
            if (_value != value)
            {
                _value = value;
                ValueChanged.InvokeAsync(value);
            }
        }
    }

For some reason the Value is true, but the EjsCheckBox is not displaying it as Checked. 
This is a functionality that worked for sure in a previous version of Syncfusion. The version that we are currently using is 17.4.40

Kind Regards,
Tsvetan

1 Reply

SD Saranya Dhayalan Syncfusion Team January 8, 2020 07:30 AM UTC

Hi Tsvetan 
 
Thank you for contacting Syncfusion support 
 
We have checked your reported issue. We are not able to reproduce it in our end. We have set the value is true in the button click event, checkbox is displaying it as checked. Please find the below code snippet: 
 
@using Syncfusion.EJ2.Blazor.Buttons 
 
<EjsCheckBox @bind-Checked="@Value" 
             Label="@Label"></EjsCheckBox> 
<br /> 
<button @onclick="btnclick">Click</button> 
 
@code  { 
 
    public string Label { get; set; } 
    private bool _value; 
    [Parameter] 
    public EventCallback<string> ValueChanged { get; set; } 
    [Parameter] 
    public bool Value 
    { 
        get => _value; 
        set 
        { 
            if (_value != value) 
            { 
                _value = value; 
                ValueChanged.InvokeAsync(value.ToString()); 
            } 
        } 
    } 
 
    public void btnclick() 
    { 
        Value = true; 
    } 
} 
 
For your convenience we have prepared a sample. Please find the below sample link: 
 
 
Could you please check whether your issue is resolved in the attached sample, if not please replicate the issue in the attached sample and get back to us, we will provide a better solution quickly. 
 
Regards, 
Saranya D 


Loader.
Live Chat Icon For mobile
Up arrow icon