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

How do you bind on an edit form?

1 Answer 149 Views
AutoComplete
This is a migrated thread and some comments may be shown as answers.
Myles
Top achievements
Rank 1
Myles asked on 14 Feb 2013, 09:16 AM
I have an edit view for a particular model.  The view contains the following Kendo autocomplete control code:

 @(Html.Kendo().AutoCompleteFor(model => model.Location).Placeholder("Please select a value")
               .Name("locationAutoComplete").BindTo((IEnumerable<LocationData>)ViewData["locationList"])
               .DataTextField("Name")) //Specifies which property of the Product to be used by the autocomplete.
               ;

The drop down auto complete is working.  However, existing values on the model (Location property) are not bound to the control.  When I open up an existing record in edit mode the autocomplete control is empty, even if the underlying Location property on the model has a value.  How does this control handle binding?

1 Answer, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 18 Feb 2013, 04:09 PM
Hello,

The name is overridden with the Name method so the value will not be bound to a field named Location but locationAutoComplete. Removing the name should resolve the problem.

Kind regards,
Daniel
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
AutoComplete
Asked by
Myles
Top achievements
Rank 1
Answers by
Daniel
Telerik team
Share this question
or