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
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Binding to Dictionary

Thread ID:





143252 Mar 11,2019 07:33 PM UTC Mar 12,2019 10:12 AM UTC ASP.NET Core - EJ 2 1
Tags: Dropdown List
Michael Lambert
Asked On March 11, 2019 07:33 PM UTC

Is it possible to bind a ejs-dropdownlist to a dictionary object from a linq query?

Dictionary<string, Guid> vEmps = res.Emps.ToDictionary(g => g.Badge, g => g.EmpId);
<ejs-dropdownlist id="ddlvEmps" dataSource="@Model.vEmps" popupHeight="220px">
    <e-dropdownlist-fields text="Key" value="Value"></e-dropdownlist-fields>
The data does get bound to the control, but looks like not in the proper format.


Prince Oliver [Syncfusion]
Replied On March 12, 2019 10:12 AM UTC

Hi Michael, 
Thank you for contacting Syncfusion support.  
We have checked shared code snippet and screen shot. In your code snippet DropDownList component’s field property is mapped to “key” and “value for text and value fields respectively, but your json data source from the controller does not match this specified key and value pair data in the json object. So, the DropDownList’ s items list is not generated.  
<ejs-dropdownlist id="ddlvEmps" dataSource="@Model.vEmps" popupHeight="220px"> 
    <e-dropdownlist-fields text="Key" value="Value"></e-dropdownlist-fields> 
The data source must be in following format to work properly with the DropDownList control. Kindly make necessary changes in your end. 
dataSource: [ 
    { "Key": "779A", "Value": "00000000-0000-0000-0000-000000000000" }, 
    { "Key": "201A", "Value": "5602d953-563e-48e3-aaf3-0020ee4434be" } 
Please let us know if you need any further assistance on this. 


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon