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

How to manually initialize AutoComplete while loading instead of automatic loading.

2 Answers 97 Views
AutoComplete
This is a migrated thread and some comments may be shown as answers.
Daniel
Top achievements
Rank 1
Daniel asked on 08 Jul 2013, 08:49 PM
Hello,

I am using Auto complete inside a form. When the form returns Kendo UI AutoComplete remembers the last input value and fills it in. But I would like to initialize it manually (in the code) instead. I tried setting the value to a variable but failed. Setting Autobind(false) did not work either.

Can you give me an example in Razor please?

I also like to do the same for dropdownlist and datepicker.

Thanks,

2 Answers, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 10 Jul 2013, 01:10 PM
Hello Daniel,

By default when posting a form, the value will be populated from the ModelState. If you wish to avoid this then you should remove the key for the autocomplete property from the ModelState. For example:

[HttpPost]
public ActionResult Index(ViewModel model)
{
    ModelState.Remove("AutoCompleteFieldName");
Regards,
Daniel
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Daniel
Top achievements
Rank 1
answered on 10 Jul 2013, 05:33 PM
Yes that works. "AutoCompleteFieldName" is the name that is assigned for the control (in the view in MVC)

Thanks,
Tags
AutoComplete
Asked by
Daniel
Top achievements
Rank 1
Answers by
Daniel
Telerik team
Daniel
Top achievements
Rank 1
Share this question
or