# AutoComplete Data Binding

This article explains the different ways to provide data to an AutoComplete component, the properties related to data binding and their results. The key requirements is to have a string field for the suggestions.

For details on Value Binding and Data Binding, and the differences between them, see the [Data Binding vs Value Binding](https://www.telerik.com/blazor-ui/documentation/common-features/data-binding/overview#data-binding-vs-value-binding) section.

There are two key ways to bind data:

* [Strings and Value Types](https://www.telerik.com/blazor-ui/documentation/components/autocomplete/data-bind#strings-and-value-types)
* [Model](https://www.telerik.com/blazor-ui/documentation/components/autocomplete/data-bind#bind-to-a-model)

> tip If you are looking for more fields from the view-model that describes the dropdown items, not just the `Value`, see the [Get model from dropdown](https://www.telerik.com/blazor-ui/documentation/knowledge-base/dropdowns-get-model) KB article and the [OnChange](https://www.telerik.com/blazor-ui/documentation/components/autocomplete/events#onchange) event.
>
> You may also want to review/join the discussion and Vote for this request: <a href="https://www.telerik.com/forums/binding-dropdownlist-value-to-complex-model" target="_blank">Binding DropDownList Value to complex model</a>

## Strings and Value Types

You can data bind the AutoComplete to a simple collection of `string` data. When you have a concrete list of options for the user to choose from, their string representation is often suitable for display and you do not need special models.

To bind the AutoComplete, you need to:

1. provide an `IEnumerable<string>` to its `Data` property,
2. point the `Value` parameter to a `string` field.

> caption Data binding an AutoComplete to a simple data source

<demo metaUrl="client/autocomplete/data-bind/simple/" height="300"></demo>

## Bind to a Model

You can bind the AutoComplete to a model in your application. This is useful when you have the data in some form already and you don't need to prepare a separate collection of suggestions.

To bind the AutoComplete to a model:

1. populate its `Data` property with the collection of items you want in the dropdown
2. set the `ValueField` to point to the corresponding name of the model that contains the string data for the suggestions
3. point the `Value` parameter to a `string` field in the view-model.

> caption Data binding an AutoComplete to a model

<demo metaUrl="client/autocomplete/data-bind/model/" height="300"></demo>

## Missing Data

The AutoComplete is, essentially, a textbox. This means that its `Value` is always a string and it is up to you to bind and/or use it. The `Data` parameter, however, is required for the functionality of the component, and it must never be `null`. If there are no suggestions that you wish to provide to the user, consider using a regular TextBox, or creating an empty collection.

> caption Minimal AutoComplete configuration for it to run

<demo metaUrl="client/autocomplete/data-bind/missing-data/" height="220"></demo>

## See Also

* [AutoComplete Overview](https://www.telerik.com/blazor-ui/documentation/components/autocomplete/overview)
* [Live Demo: AutoComplete](https://demos.telerik.com/blazor-ui/autocomplete/overview)
