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

ValueChange does not fire


            <EjsDropDownList Placeholder="NewshaCategory" ID="NewshaCategory" TValue="NameId" EnableRtl="true" AllowFiltering=true IgnoreAccent=true  DataSource="@NewshaCategoriesList">
                <DropDownListFieldSettings Value="Id" Text="Name"></DropDownListFieldSettings>
                <Syncfusion.EJ2.Blazor.DropDowns.DropDownListEvents   TValue="NameId"  ValueChange="@NewshaCategorySelected"></Syncfusion.EJ2.Blazor.DropDowns.DropDownListEvents>
            </EjsDropDownList>

       

 public void NewshaCategorySelected(Syncfusion.EJ2.Blazor.DropDowns.ChangeEventArgs<NameId> args  )
    {

        Description1 = "hello";
        
      
    }

4 Replies

BC Berly Christopher Syncfusion Team August 5, 2019 09:38 AM UTC

Hi Ebi, 

  
Greetings from Syncfusion support.  

  
While analyzing the provided code, we found that you bound the Value and Text variable of the DropDownListFieldSettings to the TValue. So, we suggest you to bind the type of Value and Text in the DropDownListFieldSettings to the TValue as mentioned In the below code example to get rid of the reported issue. Also, if you bind the event for the DropDownList component, there is no need to add “@” as the prefix of the event name.  

@using Syncfusion.EJ2.Blazor.DropDowns 
<EjsDropDownList Placeholder="NewshaCategory" ID="NewshaCategory" TValue="string" EnableRtl="true" AllowFiltering=true IgnoreAccent=true DataSource="@NewshaCategoriesList"> 
    <DropDownListFieldSettings Value="ID" Text="Text"></DropDownListFieldSettings> 
    <Syncfusion.EJ2.Blazor.DropDowns.DropDownListEvents TValue="string" ValueChange="NewshaCategorySelected"></Syncfusion.EJ2.Blazor.DropDowns.DropDownListEvents> 
</EjsDropDownList> 
<p>@Description1</p> 
@code{ 
 
    public class Games 
    { 
        public string ID { get; set; } 
        public string Text { get; set; } 
    } 
    List<Games> NewshaCategoriesList = new List<Games> { 
    new Games() { ID= "Game1", Text= "American Football" }, 
    new Games() { ID= "Game2", Text= "Badminton" }, 
    new Games() { ID= "Game3", Text= "Basketball" }, 
    new Games() { ID= "Game4", Text= "Cricket" }, 
    new Games() { ID= "Game5", Text= "Football" }, 
    new Games() { ID= "Game6", Text= "Golf" }, 
    new Games() { ID= "Game7", Text= "Hockey" }, 
    new Games() { ID= "Game8", Text= "Rugby"}, 
    new Games() { ID= "Game9", Text= "Snooker" }, 
    new Games() { ID= "Game10", Text= "Tennis"}, 
  }; 
 
    public string Description1 { get; set; } 
 
    public void NewshaCategorySelected(Syncfusion.EJ2.Blazor.DropDowns.ChangeEventArgs<string> args) 
    { 
      Description1 = "hello"; 
    } 
} 


  
Please find the sample from the below link. 

 
  
To know more about DropDownList in Blazor platform, please refer the below documentation link.  

 
  
Regards, 
Berly B.C 



ET ebi torabi August 5, 2019 11:48 AM UTC

Hi Berly 
Thank you . It works very well


IS issam July 16, 2020 01:25 PM UTC

Hello this My code,

  <SfMultiSelect AllowFiltering="true" Value="@MultiVal" Mode="@VisualMode.Box" Query="@Query" TValue="string[]" Placeholder="Chercher une ville">
                        <SfDataManager Url="api/towns/autocomplete" Adaptor="Syncfusion.Blazor.Adaptors.UrlAdaptor" CrossDomain=true></SfDataManager>
                        <MultiSelectFieldSettings Value="code" Text="name"></MultiSelectFieldSettings>
                        <MultiSelectEvents TValue="string[]" ValueChange="onChange"></MultiSelectEvents>
    </SfMultiSelect>

Event is not fired directly when values changed but only when i click out side of SfMultiSelect is there any way to change that?

Thank you.





JM Jeyanth Muthu Pratheeban Sankara Subramanian Syncfusion Team July 17, 2020 01:47 PM UTC

Hi Ebi,

Thanks for your update.

We would like to know you that by default, change event will trigger after selecting or removing values only when focus out the control. To override this behavior, and to fire this event during changing the value, we suggest you to set ChangeOnBlur as false. Please find the UG link below.

UG Link : https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.DropDowns.SfMultiSelect-1.html#Syncfusion_Blazor_DropDowns_SfMultiSelect_1_ChangeOnBlur

Regards, 
Jeyanth.

Loader.
Live Chat Icon For mobile
Up arrow icon