Casey ScriptFu Pharr
Casey ScriptFu Pharr

Reputation: 1680

How to "BindTo" Kendo Grid AutoComplete to Razor MVC Model List

I am trying to bind the Kendo AutoComplete to the model of a view. I cannot seem to get it set right. This is how i am trying to bind to the model property list

The property is a collection of the model as below:

@Html.ColumnDropDownFor(z => z.Owner, Model.OwnerList.ToKeyValueSelectList())

This is the HTML View:

 @(Html.Kendo().AutoComplete()
          .Name("countries")
          .Filter("startswith")
          .Placeholder("--Select Owner--")
          .BindTo("@z.OwnerList")
          .Separator(", ")
    )

I currently get the control rendered but know values found in the autotype. This colelction property does work when i use a control like below so i know there are values in it.

@Html.ColumnDropDownFor(z => z.Recipient, Model.OwnerList.ToKeyValueSelectList())

Upvotes: 1

Views: 1236

Answers (1)

Rahul Singh
Rahul Singh

Reputation: 21795

The BindTo method expects a collection of objects, but you are passing a string instead. Try this:-

.BindTo(Model.OwnerList.ToKeyValueSelectList())

Upvotes: 2

Related Questions