This is a migrated thread and some comments may be shown as answers.

The 'optionLabel' option is not valid due to missing fields.

1 Answer 271 Views
DropDownList
This is a migrated thread and some comments may be shown as answers.
Jessica
Top achievements
Rank 1
Jessica asked on 16 Apr 2018, 09:09 AM

Hi,

 

I am trying to render a Kendo DropDownList, I'm receiving this JavaScript error:

"Uncaught Error: The `optionLabel` option is not valid due to missing fields. Define a custom optionLabel as shown here http://docs.telerik.com/kendo-ui/api/javascript/ui/dropdownlist#configuration-optionLabel".

 

Here is my code:

@(Html.Kendo().DropDownListFor(m=>m.Payment32.SelectedPaymentCurrency)
    .DataTextField("Mnemonic")
    .DataValueField("Mnemonic")
    .OptionLabel("Select...")
    .Value(Model.Payment32.SelectedPaymentCurrency)
    .BindTo(Model.Payment32.AllCurrencies)
    .Enable(true)
    .Events(evnt => evnt.Change("SelectedPaymentCurrency_Change"))
    .HtmlAttributes(new {style = "width: 120px;"}))

 

Let me know if you need anything else!

1 Answer, 1 is accepted

Sort by
0
Ivan Danchev
Telerik team
answered on 18 Apr 2018, 08:12 AM
Hi Jessica,

I tried reproducing the exception you are getting, but was unable to do so. Attached to this reply you can find a sample MVC project in the Index view of which there is a DropDownList helper. The option label is displayed as expected and no exceptions are thrown neither initially nor on item or option label selection. Could you modify the example so that it demonstrates the error and attach it back for further review?

Regards,
Ivan Danchev
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
DropDownList
Asked by
Jessica
Top achievements
Rank 1
Answers by
Ivan Danchev
Telerik team
Share this question
or