Explicit declaration "Enabled" property of "EjsDropDownList" doesn't allow to change the one dynamically and allow if the property is not declared.

Hi
I tried to enable and disable EjsDropDownList component dynamically and found out:
1. If the "Enabled" property is not  explicitly declared,  the component can be disabled and enabled w/o any problem on any event in code
2. If the "Enabled" property is explicitly declared e.g. 
<EjsDropDownList @ref="Foo" @ref:suppressField TValue="string" Index="0" DataSource="@Bar" Enabled="false" ...>
     .......................................
</EjsDropDownList>
any efforts in code to change value of "Enabled" (Foo.Enabled = true;) don't enable  the EjsDropDownList component
3. Used: Syncfusion.EJ2.Blazor v.17.2.0.47-beta,  Blazor v. 3.0.0-preview8.19405.7
Regards,
Oleg

1 Reply

GG Gopi Govindasamy Syncfusion Team September 6, 2019 10:05 AM UTC

Hi Oleg,  

Greetings for Syncfusion support. 

We would like to inform you that we have provided property binding support in our component. So, we can achieve enable/disable even we defined the proper explicitly. You can directly update the “Enabled” property on button click.  

Please find the code snippet and sample for your reference. 

@using Syncfusion.EJ2.Blazor.DropDowns 
 
<h6>DropDownList</h6> 
 
<button @onclick="OnClick">Enable</button> 
 
<EjsDropDownList TValue="string" Index="0" DataSource="@Country" Enabled="@enable"> 
    <DropDownListFieldSettings Text="Name" Value="Code"></DropDownListFieldSettings> 
</EjsDropDownList> 
 
@code{ 
 
    private bool enable { get; set; } = false; 
 
    void OnClick() 
    { 
        this.enable = true; 
    } 
 
    public class Countries 
    { 
        public string Name { get; set; } 
 
        public string Code { get; set; } 
    } 
 
    List<Countries> Country = new List<Countries> 
{ 
        new Countries() { Name = "Australia", Code = "AU" }, 
        new Countries() { Name = "Bermuda", Code = "BM" }, 
        new Countries() { Name = "Canada", Code = "CA" }, 
        new Countries() { Name = "Cameroon", Code = "CM" }, 
    }; 
} 

We have prepared sample based on your requirement, and download it from the below location.  


Regards, 
Gopi G. 
 


Loader.
Up arrow icon