New to Telerik UI for ASP.NET MVC? Download free 30-day trial

ComboBoxBuilder

Methods

AutoBind(System.Boolean)

Controls whether to bind the component to the DataSource on initialization.

Parameters

autoBind - System.Boolean

Example


             @(Html.Kendo().ComboBox()
                        .Name("ComboBox")
                        .AutoBind(false)
            )

AutoWidth(System.Boolean)

Controls whether to adjust the popup width

Parameters

autoWidth - System.Boolean

Example


             @(Html.Kendo().ComboBox()
                        .Name("ComboBox")
                        .AutoWidth(false)
            )

BindTo(System.Collections.Generic.IEnumerable)

Binds the ComboBox to a list of DropDownListItem.

Parameters

dataSource - System.Collections.Generic.IEnumerable<DropDownListItem>

The data source.

Example


             @(Html.Kendo().ComboBox()
                        .Name("ComboBox")
                        .BindTo(new List<DropDownListItem>
                            {
                                new DropDownListItem {
                                    Text = "Text1",
                                    Value = "Value1"
                                },
                                new DropDownListItem {
                                    Text = "Text2",
                                    Value = "Value2"
                                } })
                )

BindTo(System.Collections.Generic.IEnumerable)

Binds the ComboBox to a list of DropDownListItem.

Parameters

dataSource - System.Collections.Generic.IEnumerable<SelectListItem>

The data source.

Example


             @(Html.Kendo().ComboBox()
                        .Name("ComboBox")
                        .BindTo(new List<DropDownListItem>
                            {
                                new DropDownListItem {
                                    Text = "Text1",
                                    Value = "Value1"
                                },
                                new DropDownListItem {
                                    Text = "Text2",
                                    Value = "Value2"
                                } })
                )

ClearButton(System.Boolean)

Use to enable or disable clear button functionality.

Parameters

enable - System.Boolean

The boolean value.

Example


            @(Html.Kendo().ComboBox()
                       .Name("ComboBox")
                       .ClearButton(false)
            )

DataValueField(System.String)

Sets the field of the data item that provides the value content of the list items.

Parameters

field - System.String

The name of the field.

Example


             @(Html.Kendo().ComboBox()
                        .Name("ComboBox")
                        .DataTextField("Text")
                        .DataValueField("Value")
            )

EnforceMinLength(System.Boolean)

If set to true the component will not show all items when the text of the search input cleared. By default the component shows all items when the text of the search input is cleared. Works in conjunction with minLength.

Parameters

enforceMinLength - System.Boolean

The boolean value.

Example


             @(Html.Kendo().ComboBox()
                        .Name("ComboBox")
                        .MinLength(3)
                        .Filter("contains")
                        .EnforceMinLength(true)
            )

Events(System.Action)

Configures the client-side events.

Parameters

clientEventsAction - System.Action<ComboBoxEventBuilder>

The client events action.

Example


             @(Html.Kendo().ComboBox()
                        .Name("ComboBox")
                        .Events(events =>
                            events.Change("change")
                        )
            )

Filter(System.String)

Enables the filtering of items.

Parameters

filter - System.String

The type of filtering.

Example


             @(Html.Kendo().ComboBox()
                        .Name("ComboBox")
                        .Filter("startswith");
            )

Filter(Kendo.Mvc.UI.FilterType)

Enables the filtering of items.

Parameters

filter - FilterType

The type of filtering.

Example


             @(Html.Kendo().ComboBox()
                        .Name("ComboBox")
                        .Filter(FilterType.Contains);
            )

Items(System.Action)

Defines the items in the ComboBox

Parameters

addAction - System.Action<DropDownListItemFactory>

The add action.

Example


             @(Html.Kendo().ComboBox()
                        .Name("ComboBox")
                        .Items(items =>
                        {
                            items.Add().Text("First Item");
                            items.Add().Text("Second Item");
                        })
            )

HighlightFirst(System.Boolean)

Use it to enable or disable the highlighting of the first matched item.

Parameters

highlightFirst - System.Boolean

If true, enables the highlighting.

Example


             @(Html.Kendo().ComboBox()
                        .Name("ComboBox")
                        .HighlightFirst(true)
            )

Messages(System.Action)

The text messages displayed in the component. Use it to customize or localize the messages.

Parameters

configurator - System.Action<MessagesSettingsBuilder>

The action that configures the messages.

MinLength(System.Int32)

Specifies the minimum number of characters that should be typed before the component queries the dataSource.

Parameters

length - System.Int32

The number of characters.

Example


             @(Html.Kendo().ComboBox()
                        .Name("ComboBox")
                        .MinLength(3)
            )

SelectedIndex(System.Int32)

Sets the index of the item that will be selected.

Parameters

index - System.Int32

The index of the item.

Example


             @(Html.Kendo().ComboBox()
                        .Name("ComboBox")
                        .SelectedIndex(0);
            )

Suggest(System.Boolean)

Controls whether the ComboBox should automatically auto-type the rest of text.

Parameters

suggest - System.Boolean

If true, enables auto-type.

Example


             @(Html.Kendo().ComboBox()
                        .Name("ComboBox")
                        .Suggest(true)
            )

SyncValueAndText(System.Boolean)

Controls whether the ComboBox should automatically sync custom text with the selected value.

Parameters

syncValueAndText - System.Boolean

Example


             @(Html.Kendo().ComboBox()
                        .Name("ComboBox")
                        .SyncValueAndText(false)
            )

Placeholder(System.String)

A string that appears in the textbox when it has no value.

Parameters

placeholder - System.String

The text that will appear as placeholder.

Example


             @(Html.Kendo().ComboBox()
                        .Name("ComboBox")
                        .Placeholder("Select country...")
            )

CascadeFrom(System.String)

Specifies the Id of the parent ComboBox, from which the child will cascade.

Parameters

cascadeFrom - System.String

The Id of the parent ComboBox.

Example


             @(Html.Kendo().ComboBox()
                        .Name("ComboBox2")
                        .CascadeFrom("ComboBox1")
            )

CascadeFromField(System.String)

Sets the field used to filter the data source.

Parameters

cascadeFromField - System.String

The name of the field.

Example


             @(Html.Kendo().ComboBox()
                        .Name("ComboBox2")
                        .CascadeFrom("ComboBox1")
                        .CascadeFromField("ParentID")
            )

CascadeFromParentField(System.String)

Defines the parent field to be used to retain value from. This value will be used further to filter the data source.

Parameters

cascadeFromParentField - System.String

The name of the field.

Example


             @(Html.Kendo().ComboBox()
                        .Name("ComboBox2")
                        .CascadeFrom("ComboBox1")
                        .CascadeFromField("ParentID")
                        .CascadeFromParentField("ParentID")
            )

CascadeOnCustomValue(System.Boolean)

Applicable to a parent ComboBox in a cascading scenario. If set to true cascading will be triggered upon custom input in the parent component. When set to false (default) the child will not cascade and it will be disabled upon setting custom input in the parent ComboBox. Cascade on custom values works only when cascadeFromParentField is not set for the child combo, or it points to the dataValueField of the parent.

Parameters

value - System.Boolean

If true, enables cascading from a custom value.

Example


             @(Html.Kendo().ComboBox()
                   .Name("ComboBox2")
                   .CascadeFrom("ComboBox1")
                   .CascadeOnCustomValue(true)
            )

CascadeOnCustomValue()

Applicable to a parent ComboBox in a cascading scenario. If set to true cascading will be triggered upon custom input in the parent component. When set to false (default) the child will not cascade and it will be disabled upon setting custom input in the parent ComboBox. Cascade on custom values works only when cascadeFromParentField is not set for the child combo, or it points to the dataValueField of the parent.

Example


             @(Html.Kendo().ComboBox()
                   .Name("ComboBox2")
                   .CascadeFrom("ComboBox1")
                   .CascadeOnCustomValue(true)
            )

Text(System.String)

Define the text of the component, when AutoBind is set to false.

Parameters

text - System.String

The text to be shown in the input.

Example


             @(Html.Kendo().ComboBox()
                        .Name("ComboBox")
                        .Text("Chai")
                        .AutoBind(false)
            )

Size(Kendo.Mvc.UI.ComponentSize)

Sets the size of the component.

Parameters

value - ComponentSize

The value for Size.

Example


             @(Html.Kendo().ComboBox()
                        .Name("ComboBox")
                        .Size(ComponentSize.Medium)
            )

Rounded(Kendo.Mvc.UI.Rounded)

Sets a value controlling the border radius.

Parameters

value - Rounded

The value for Rounded.

Example


             @(Html.Kendo().ComboBox()
                        .Name("ComboBox")
                        .Rounded(Rounded.Medium)
            )

FillMode(Kendo.Mvc.UI.FillMode)

Sets a value controlling how the color is applied.

Parameters

value - FillMode

The value for FillMode.

Example


             @(Html.Kendo().ComboBox()
                        .Name("ComboBox")
                        .FillMode(FillMode.Solid)
            )

PrefixOptions(System.Action)

The configuration for the prefix adornment of the widget.

Parameters

configurator - System.Action<PrefixOptionsSettingsBuilder>

The action that configures the prefix options.

SuffixOptions(System.Action)

The configuration for the suffix adornment of the widget.

Parameters

configurator - System.Action<SuffixOptionsSettingsBuilder>

The action that configures the suffix options.

Template(System.String)

Template to be used for rendering the items in the list.

Parameters

template - System.String

Example


             @( Html.Kendo().DropDownList()
                        .Name("DropDownList")
                        .Template("#= data #")
            )

TemplateId(System.String)

TemplateId to be used for rendering the items in the list.

Parameters

templateId - System.String

Example


             @( Html.Kendo().DropDownList()
                        .Name("DropDownList")
                        .TemplateId("widgetTemplateId")
            )

TemplateView(System.Web.Mvc.MvcHtmlString)

TemplateView to be used for rendering the items in the list.

Parameters

templateView - System.Web.Mvc.MvcHtmlString

Example


             @( Html.Kendo().DropDownList()
                        .Name("DropDownList")
                        .TemplateView(Html.Partial("TemplateView"))
            )

TemplateHandler(System.String)

Parameters

template - System.String

Value(System.String)

Sets the value of the widget.

Parameters

value - System.String

Example


             @( Html.Kendo().DropDownList()
                        .Name("DropDownList")
                        .Value("1")
            )

Animation(System.Boolean)

Use to enable or disable animation of the popup element.

Parameters

enable - System.Boolean

The boolean value.

Example


            @( Html.Kendo().DropDownList()
                       .Name("DropDownList")
                       .Animation(false) //toggle effect
            )

Animation(System.Action)

Configures the animation effects of the widget.

Parameters

animationAction - System.Action<PopupAnimationBuilder>

The action which configures the animation effects.

Example


            @( Html.Kendo().DropDownList()
                       .Name("DropDownList")
                       .Animation(animation =>
                       {
                            animation.Open(open =>
                            {
                                open.SlideIn(SlideDirection.Down);
                            });
                       })
            )

BindTo(System.Collections.IEnumerable)

Binds the widget to an IEnumerable list.

Parameters

data - System.Collections.IEnumerable

The data source.

Example


             @( Html.Kendo().DropDownList()
                        .Name("DropDownList")
                        .DataTextField("CompanyName")
                        .DataValueField("CompanyID")
                        .BindTo(new List<Company>
                        {
                            new Company {
                                CompanyName = "Text1",
                                CompanyID = "Value1"
                            },
                            new Company {
                                CompanyName = "Text2",
                                CompanyID = "Value2"
                            } })
            )

DataTextField(System.String)

Sets the field of the data item that provides the text content of the list items.

Parameters

field - System.String

Example


             @( Html.Kendo().DropDownList()
                        .Name("DropDownList")
                        .DataTextField("Text")
            )

DataSource(System.Action)

Configures the DataSource options.

Parameters

configurator - System.Action<ReadOnlyDataSourceBuilder>

The DataSource configurator action.

Example


             @( Html.Kendo().DropDownList()
                        .Name("DropDownList")
                        .DataSource(source =>
                        {
                            source.Read(read =>
                            {
                                read.Action("GetProducts", "Home");
                            });
                        })
            )

DataSource(System.String)

Parameters

dataSourceId - System.String

Delay(System.Int32)

Specifies the delay in ms after which the widget will start filtering the dataSource.

Parameters

delay - System.Int32

Example


             @( Html.Kendo().DropDownList()
                        .Name("DropDownList")
                        .Delay(300)
            )

Enable(System.Boolean)

Enables or disables the combobox.

Parameters

value - System.Boolean

FixedGroupTemplate(System.String)

Fixed group template which will be rendered as a static group header of the popup element.

Parameters

fixedGroupTemplate - System.String

FixedGroupTemplateId(System.String)

FixedGroupTemplateId to be used for rendering the static header of the popup element.

Parameters

fixedGroupTemplateId - System.String

FixedGroupTemplateView(System.Web.Mvc.MvcHtmlString)

FixedGroupTemplateView to be used for rendering the static header of the popup element.

Parameters

fixedGroupTemplateView - System.Web.Mvc.MvcHtmlString

FixedGroupTemplateHandler(System.String)

Parameters

value - System.String

GroupTemplate(System.String)

Group template which will be rendered as a group header of each new group in the popup.

Parameters

groupTemplate - System.String

GroupTemplateId(System.String)

GroupTemplateId to be used for rendering the static header of the popup element.

Parameters

groupTemplateId - System.String

GroupTemplateView(System.Web.Mvc.MvcHtmlString)

GroupTemplateView to be used for rendering the static header of the popup element.

Parameters

groupTemplateView - System.Web.Mvc.MvcHtmlString

GroupTemplateHandler(System.String)

Parameters

value - System.String

IgnoreCase(System.Boolean)

Use it to enable case insensitive bahavior of the combobox. If true the combobox will select the first matching item ignoring its casing.

Parameters

ignoreCase - System.Boolean

Example


             @( Html.Kendo().ComboBox()
                        .Name("ComboBox")
                        .IgnoreCase(true)
            )

Height(System.Int32)

Sets the height of the drop-down list in pixels.

Parameters

height - System.Int32

Example


             @( Html.Kendo().DropDownList()
                        .Name("DropDownList")
                        .Height(300)
            )

HeaderTemplate(System.String)

Header template which will be rendered as a static header of the popup element.

Parameters

headerTemplate - System.String

Example

 ")
            )

HeaderTemplateId(System.String)

HeaderTemplateId to be used for rendering the static header of the popup element.

Parameters

headerTemplateId - System.String

Example


             @( Html.Kendo().DropDownList()
                        .Name("DropDownList")
                        .HeaderTemplateId("widgetHeaderTemplateId")
            )

HeaderTemplateView(System.Web.Mvc.MvcHtmlString)

HeaderTemplateView to be used for rendering the static header of the popup element.

Parameters

headerTemplateView - System.Web.Mvc.MvcHtmlString

Example


             @( Html.Kendo().DropDownList()
                        .Name("DropDownList")
                        .HeaderTemplateView(Html.Partial("HeaderTemplate"))
            )

HeaderTemplateHandler(System.String)

Parameters

value - System.String

FooterTemplate(System.String)

Footer template which will be rendered as a static footer of the popup element.

Parameters

footerTemplate - System.String

Example

  items found")
            )

FooterTemplateId(System.String)

FooterTemplateId to be used for rendering the static footer of the popup element.

Parameters

footerTemplateId - System.String

Example


             @( Html.Kendo().DropDownList()
                        .Name("DropDownList")
                        .FooterTemplateId("widgetFooterTemplateId")
            )

FooterTemplateView(System.Web.Mvc.MvcHtmlString)

FooterTemplateView to be used for rendering the static footer of the popup element.

Parameters

footerTemplateView - System.Web.Mvc.MvcHtmlString

Example


             @( Html.Kendo().DropDownList()
                        .Name("DropDownList")
                        .FooterTemplateView(Html.Partial("FooterTemplate"))
            )

FooterTemplateHandler(System.String)

Parameters

value - System.String

NoDataTemplate(System.String)

No data template which will be rendered as a static no-data template of the popup element.

Parameters

noDataTemplate - System.String

Example


             @( Html.Kendo().DropDownList()
                        .Name("DropDownList")
                        .NoDataTemplate("No Data!")
            )

NoDataTemplateId(System.String)

NoDataTemplateId to be used for rendering the static no-data template of the popup element.

Parameters

noDataTemplateId - System.String

Example


             @( Html.Kendo().DropDownList()
                        .Name("DropDownList")
                        .NoDataTemplateId("widgetNoDataTemplateId")
            )

NoDataTemplateView(System.Web.Mvc.MvcHtmlString)

NoDataTemplateView to be used for rendering the static no-data template of the popup element.

Parameters

noDataTemplateView - System.Web.Mvc.MvcHtmlString

Example


             @( Html.Kendo().DropDownList()
                        .Name("DropDownList")
                        .NoDataTemplateView(Html.Partial("NoDataTemplate"))
            )

NoDataTemplateHandler(System.String)

Parameters

value - System.String

Popup(System.Action)

Configures the popup settings of the widget.

Parameters

popupAction - System.Action<PopupSettingsBuilder>

ValuePrimitive(System.Boolean)

Parameters

valuePrimitive - System.Boolean

Virtual(System.Boolean)

Configures the virtualization settings of the widget.

Parameters

enable - System.Boolean

Virtual(System.Action)

Configures the virtualization settings of the widget.

Parameters

virtualizationAction - System.Action<VirtualSettingsBuilder>

Label(System.Action)

Adds a label before the input. If the input has no id attribute, a generated id will be assigned. The string and the function parameters are setting the inner HTML of the label.

Parameters

configurator - System.Action<LabelSettingsBuilder>

AdaptiveMode(Kendo.Mvc.UI.AdaptiveMode)

Parameters

value - AdaptiveMode

ToComponent()

Returns the internal view component.

Name(System.String)

Sets the name of the component.

Parameters

componentName - System.String

The name of the component.

Example


            @(Html.Kendo().Grid<OrderViewModel>()
               .Name("grid")
               .Columns(columns =>
               {
                   columns.Bound(p => p.OrderID).Filterable(false);
                   columns.Bound(p => p.Freight);  
               })
               .DataSource(dataSource => dataSource
                   .Ajax()
                   .PageSize(20)
                   .Read(read => read.Action("Orders_Read", "Grid"))
               )
            )

Deferred(System.Boolean)

Suppress initialization script rendering. Note that this options should be used in conjunction with Kendo.Mvc.UI.Fluent.WidgetFactory.DeferredScripts(System.Boolean)

Parameters

deferred - System.Boolean

ModelMetadata(System.Web.Mvc.ModelMetadata)

Uses the Metadata of the Model.

Parameters

modelMetadata - System.Web.Mvc.ModelMetadata

The metadata set for the Model

HtmlAttributes(System.Object)

Sets the HTML attributes.

Parameters

attributes - System.Object

The HTML attributes.

HtmlAttributes(System.Collections.Generic.IDictionary)

Parameters

attributes - System.Collections.Generic.IDictionary<String,Object>

AsChildComponent()

Render()

Renders the component.

Example


            @(@Page Inherits="System.Web.Mvc.ViewPage<IEnumerable<Product>>" )
            @( Html.Kendo().Grid(Model)
                .Name("grid")
                .DetailTemplate(product => {
                    )
                       Product Details:
                       <div>Product Name: @( product.ProductName )</div>
                       <div>Units In Stock: @( product.UnitsInStock )</div>
                    @(
                })
                .Render();
            )

ToHtmlString()

ToClientTemplate()

In this article
Not finding the help you need?