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

Get selected value from Dropdownlist

Hi!
Im using the latest version of Syncfusion Blazor (17.4.0.47)
I would like to get the selected item of a dropdownlist.
When i execute the button click and query _dropdown.Value, the result is always null.
I just updated the version, and it worked in older version of the components.
Thanks and regards,
Michael


Example code:
 
EjsDropDownList @ref="@_dropdown" TValue="int?" TItem="RowData" Placeholder="placeholder" DataSource="@list"
  DropDownListFieldSettings Value="Id" Text="Text">
/EjsDropDownList

EjsButton OnClick="@Clicked" /EjsButton

@code {
  public EjsDropDownList _dropdown;

  public List list = new List() {
    new RowData() { Id = 1, Text = "Text1"},
    new RowData() { Id = 2, Text = "Text2"}
  };

  public void Clicked(MouseEventArgs args) {
    var value = _dropdown.Value; // <= always null

  }

  public class RowData {
    public int Id { get; set; }
    public string Text { get; set; }
  }
}




There are other (working) solutions, like hook the onChange event, buts not that clean, and i wouldnt like to do it with bindings...




4 Replies

MS Michael Sandler February 10, 2020 05:08 PM UTC

When using the version 17.4.44
things are working like expected.

regards michael


SN Sevvandhi Nagulan Syncfusion Team February 12, 2020 06:31 AM UTC

Hi Michael,   
 
Thank you for your update  
 
We have resolved the reported issue in the latest version (V17.4.49). We suggest you upgrade the NuGet package and scripts to the latest version V17.4.49.   
 
  
Latest script files:  
  
[Host.cshtml]  
    <link rel='nofollow' href="https://cdn.syncfusion.com/ej2/17.4.49/material.css" rel="stylesheet" />   
    <script src="https://cdn.syncfusion.com/ej2/17.4.49/dist/ej2.min.js"></script>   
  
Please find the test sample with the latest NuGet and script files in the below link  
 
Regards,   
Sevvandhi N  



MS Michael Sandler February 13, 2020 07:20 AM UTC

Now it works

Thanks for the fast solution!

Regards Michael


PO Prince Oliver Syncfusion Team February 14, 2020 05:12 AM UTC

Hi Michael, 
 
Most Welcome. We are happy to assist you. 
 
Regards, 
Prince 


Loader.
Up arrow icon