New to Telerik UI for ASP.NET Core? Start a free 30-day trial
ASP.NET Core AutoComplete Overview
The Telerik UI AutoComplete TagHelper and HtmlHelper for ASP.NET Core are server-side wrappers for the Kendo UI AutoComplete widget.
The AutoComplete provides suggestions depending on the typed text and allows multiple value entries.
Initializing the AutoComplete
The following example demonstrates how to define the AutoComplete.
Razor
@(Html.Kendo().AutoComplete()
.Name("autocomplete")
.DataTextField("ProductName")
.Filter("contains")
.DataSource(source =>
{
source.Read(read =>
{
read.Action("Products_Read", "AutoComplete")
.Data("onAdditionalData");
})
.ServerFiltering(true);
})
)
<script type="text/javascript">
function onAdditionalData() {
return {
text: $("#autocomplete").val()
};
}
</script>
Starting with the 2024 Q3 release, the HtmlHelper version of the component supports declarative initialization.
Basic Configuration
The following example demonstrates the basic configuration of the AutoComplete.
Razor
@(Html.Kendo().AutoComplete()
.Name("products2")
.DataTextField("ProductName")
.Filter("contains")
.MinLength(3)
.HtmlAttributes(new { style = "width:100%" })
.DataSource(source =>
{
source
.Read(read =>
{
read.Action("GetProducts", "Home")
.Data("onAdditionalData");
})
.ServerFiltering(true);
})
)
<script>
function onAdditionalData() {
return {
text: $("#products").val() // sends the typed value from the AutoComplete to the server
};
}
</script>
Functionality and Features
- Data binding—The AutoComplete supports multiple data binding approaches: server, model, custom, and ajax binding.
- Grouping—You can group the data that is displayed in the AutoComplete.
- Templates—To take full control over the rendering of the AutoComplete items, popup header, and popup footer, you can use the available templates.
- Virtualization—The built-in virtualization allows you to display large datasets.
- Accessibility—The AutoComplete is accessible by screen readers and provides WAI-ARIA, Section 508, WCAG 2.2, and keyboard support.
Next Steps
-
Basic Usage of the AutoComplete HtmlHelper for ASP.NET Core (Demo)
-
Basic Usage of the AutoComplete TagHelper for ASP.NET Core (Demo)