|
| 1 | +--- |
| 2 | +title: ComboBox |
| 3 | +page_title: ComboBox | Telerik UI for ASP.NET Core Tag Helpers |
| 4 | +description: "Learn the basics when working with the ComboBox tag helper for ASP.NET Core (MVC 6 or ASP.NET Core MVC)." |
| 5 | +previous_url: /aspnet-core/helpers/combobox |
| 6 | +slug: taghelpers_combobox_aspnetcore |
| 7 | +--- |
| 8 | + |
| 9 | +# ComboBox Tag Helper Overview |
| 10 | + |
| 11 | +The ComboBox tag helper helps you configure the Kendo UI ComboBox widget in ASP.NET Core applications. |
| 12 | + |
| 13 | +## Basic Usage |
| 14 | + |
| 15 | +The following example demonstrates how to define the ComboBox by using the ComboBox tag helper. |
| 16 | + |
| 17 | +###### Example |
| 18 | + |
| 19 | + <kendo-combobox name="products" filter="FilterType.StartsWith"></kendo-combobox> |
| 20 | + |
| 21 | +## Configuration |
| 22 | + |
| 23 | +The ComboBox tag helper configuration options are passed as attributes of the tag. |
| 24 | + |
| 25 | +###### Example |
| 26 | + |
| 27 | +```tab-cshtml |
| 28 | +
|
| 29 | + @(Html.Kendo().ComboBox() |
| 30 | + .Name("products") |
| 31 | + .Placeholder("Select product") |
| 32 | + .DataTextField("ProductName") |
| 33 | + .DataValueField("ProductID") |
| 34 | + .HtmlAttributes(new { style = "width:100%;" }) |
| 35 | + .Filter(FilterType.Contains) |
| 36 | + .AutoBind(false) |
| 37 | + .MinLength(3) |
| 38 | + .DataSource(source => |
| 39 | + { |
| 40 | + source.Read(read => |
| 41 | + { |
| 42 | + read.Action("GetProducts", "Home"); |
| 43 | + }) |
| 44 | + .ServerFiltering(true); |
| 45 | + }) |
| 46 | + ) |
| 47 | +``` |
| 48 | +```tab-tagHelper |
| 49 | +
|
| 50 | + <kendo-combobox name="products" filter="FilterType.Contains" |
| 51 | + placeholder="Select product" |
| 52 | + datatextfield="ProductName" |
| 53 | + datavaluefield="ProductID" |
| 54 | + auto-bind="false" |
| 55 | + min-length="3" style="width: 100%;"> |
| 56 | + <datasource type="DataSourceTagHelperType.Custom" server-filtering="true"> |
| 57 | + <transport> |
| 58 | + <read url="@Url.Action("GetProducts", "Home")" data="onAdditionalData" /> |
| 59 | + </transport> |
| 60 | + </datasource> |
| 61 | + </kendo-combobox> |
| 62 | +
|
| 63 | + <script> |
| 64 | + function onAdditionalData() { |
| 65 | + return kendo.ui.ComboBox.requestData(jQuery("#products")); |
| 66 | + } |
| 67 | + </script> |
| 68 | +``` |
| 69 | + |
| 70 | +## See Also |
| 71 | + |
| 72 | +* [Overview of Telerik UI for ASP.NET Core]({% slug overview_aspnetmvc6_aspnetmvc %}) |
| 73 | +* [Get Started with Telerik UI for ASP.NET Core in ASP.NET Core Projects]({% slug gettingstarted_aspnetmvc6_aspnetmvc %}) |
| 74 | +* [Get Started with Telerik UI for ASP.NET Core in ASP.NET Core Projects on Linux]({% slug gettingstartedlinux_aspnetmvc6_aspnetmvc %}) |
| 75 | +* [Known Issues with Telerik UI for ASP.NET Core]({% slug knownissues_aspnetmvc6_aspnetmvc %}) |
0 commit comments