JJ Xiluisen
JJ Xiluisen

Reputation: 77

Kendo-UI DropDownListFor - selected index

I need to change standard dropdown list to the one from kendo and and I've got a problem with getting appropriate selected value. This code gives me a dropdown list with correct values, but doesn't give selected value (first one is selected).

@(Html.Kendo().DropDownListFor(m => m.CountryName)              
        .BindTo(Model.AllCountries)                     
        .OptionLabel("-- Select country --")               
    )

Inside span (generated by kendo) with this dropdown I found input (type = text) with all values as options, and this input has correct value. How to display this value in my kendo dropdown? Thanks

Upvotes: 1

Views: 1349

Answers (1)

Mark Erasmus
Mark Erasmus

Reputation: 2385

Have you tried setting the name of the DropDownList equal to the name of the property in your model? The Kendo Documentation suggests that "if widget's name is different than the Model's property then the ModelBinder will not be able to update the model."

Upvotes: 1

Related Questions