optionLabelTemplate String|Function

The template used to render the option label. Use optionLabelTemplate if you want to customize the markup of the optionLabel.

  • optionLabel has to be defined for the optionLabelTemplate to take effect.
  • Define the optionLabel as object if complex template structure is used

Example - specify the optionLabelTemplate as a string

<input id="dropdownlist" />
<script>
$("#dropdownlist").kendoDropDownList({
    dataSource: [
      { productName: "Product 1", productId: 1 },
      { productName: "Product 2", productId: 2 },
      { productName: "Product 3", productId: 3 },
      { productName: "Product 4", productId: 4 }
    ],
    dataTextField: "productName",
    dataValueField: "productId",
    optionLabel: "-- Please select --",
    optionLabelTemplate:'<span style="color:red">-- Please select --</span>'
});
</script>
In this article
Not finding the help you need? Improve this article