Kendo MVC Autocomplete Selected Value

2.6k Views Asked by At

I am using Kendo MVC Autocomplete. How do I set the selected value?

A bit of background. My page has the autocomplete control, and allows users to select a client via the autocomplete. If the client is not found, it provides an option to add a new client via a kendo popop window.

After the new client is saved to my db my datasource is refreshed. But the issue is the client I just added must be selected in the Autocomplete box. When I search for the client it does show up, but it must be automatically selected when my new client popup closes.

Any help will be appreciated.

1

There are 1 best solutions below

2
On

By default Kendo Auto Complete doesn't shows any value.It is specifically made to suggest the values by searching the value entered by the user in the database.

But you can still try these options:-

1) Set suggest property as true : If set to true the widget will automatically use the first suggestion as its value.

<input id="autocomplete" />
<script>
$("#autocomplete").kendoAutoComplete({
  suggest: true
});
</script>

2)Set highlightFirst property as true : If set to true the first suggestion will be automatically highlighted.

<input id="autocomplete" />
<script>
$("#autocomplete").kendoAutoComplete({
  highlightFirst: true
});
</script>

Revert in case any of these works.