using a key/value pair array for datasource for DropDownList

1 Answer 15 Views
DropDownList
journeyman
Top achievements
Rank 1
journeyman asked on 10 Feb 2026, 10:40 AM

is it possible to add a key/value  pair array  for datasource for DropDownList

The guide here shows how to add a value/array as the datasource.

<input id="dropdownlist" />
<script>
$("#dropdownlist").kendoDropDownList({
  dataSource: {
    data: ["One", "Two"]
  }
});
</script>

However I need something like this. i.e a key/value pair.

i.e I need to display the key in the dropdown but return the value if the dropdown is selected.

<input id="dropdownlist" /><script>
$("#dropdownlist").kendoDropDownList({
  dataSource: {
    data: [{email: 'one'} , {email: 'Two'}],
    dataTextFiled: "email",
    dataValueField: "email"
  }
});
</script>

 

1 Answer, 1 is accepted

Sort by
0
Eyup
Telerik team
answered on 11 Feb 2026, 08:10 PM

Hello,

 

Thank you for reaching out.

Yes, it is possible to use a key/value pair array as the data source for the Kendo UI DropDownList. You just need to configure the dataTextField and dataValueField options to specify which fields to use for display and value.

Here’s how you can set it up:

  • Your data source should be an array of objects, each with the desired keys.
  • Use dataTextField to specify the field to display in the dropdown.
  • Use dataValueField to specify the field to use as the value when an item is selected.

Example:

$("#dropdownlist").kendoDropDownList({
  dataSource: {
    data: [
      { key: "First", value: 1 },
      { key: "Second", value: 2 }
    ]
  },
  dataTextField: "key",      // Displayed in the dropdown
  dataValueField: "value"    // Used as the value when selected
});

If your object only has one property (e.g., { email: "one@example.com" }), you can set both dataTextField and dataValueField to "email".

Note: In your example, there is a typo: it should be dataTextField, not dataTextFiled.

If you want to display a combination of fields (e.g., firstName + lastName), you can use the template option:

$("#dropdownlist").kendoDropDownList({
  dataSource: {
    data: [
      { firstName: "John", lastName: "Doe", id: 1 },
      { firstName: "Jane", lastName: "Smith", id: 2 }
    ]
  },
  dataTextField: "firstName",   // Required, but overridden by template
  dataValueField: "id",
  template: "#= firstName # #= lastName #"
});

For more details, see:

 

Let me know what you think and if this is helpful.

 

    Regards,
    Eyup
    Progress Telerik

    Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

    Tags
    DropDownList
    Asked by
    journeyman
    Top achievements
    Rank 1
    Answers by
    Eyup
    Telerik team
    Share this question
    or