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

Defines the fluent interface for configuring the ComboBox component.

Definition

Namespace:Kendo.Mvc.UI.Fluent

Assembly:Kendo.Mvc.dll

Syntax:

C#
public class ComboBoxBuilder : DropDownListBuilderBase<ComboBox, ComboBoxBuilder>, IHtmlString

Inheritance: objectWidgetBuilderBase<ComboBox, ComboBoxBuilder>ListBuilderBase<ComboBox, ComboBoxBuilder>DropDownListBuilderBase<ComboBox, ComboBoxBuilder>ComboBoxBuilder

Implements: IHtmlString

Inherited Members DropDownListBuilderBase<ComboBox, ComboBoxBuilder>.Template(string)DropDownListBuilderBase<ComboBox, ComboBoxBuilder>.TemplateId(string)DropDownListBuilderBase<ComboBox, ComboBoxBuilder>.TemplateView(MvcHtmlString)DropDownListBuilderBase<ComboBox, ComboBoxBuilder>.TemplateHandler(string)DropDownListBuilderBase<ComboBox, ComboBoxBuilder>.Template<TModel>(TemplateBuilder<TModel>)DropDownListBuilderBase<ComboBox, ComboBoxBuilder>.Value(string)ListBuilderBase<ComboBox, ComboBoxBuilder>.Animation(bool)ListBuilderBase<ComboBox, ComboBoxBuilder>.Animation(Action<PopupAnimationBuilder>)ListBuilderBase<ComboBox, ComboBoxBuilder>.BindTo(IEnumerable)ListBuilderBase<ComboBox, ComboBoxBuilder>.DataTextField(string)ListBuilderBase<ComboBox, ComboBoxBuilder>.DataSource(Action<ReadOnlyDataSourceBuilder>)ListBuilderBase<ComboBox, ComboBoxBuilder>.DataSource(string)ListBuilderBase<ComboBox, ComboBoxBuilder>.Delay(int)ListBuilderBase<ComboBox, ComboBoxBuilder>.Enable(bool)ListBuilderBase<ComboBox, ComboBoxBuilder>.FixedGroupTemplate(string)ListBuilderBase<ComboBox, ComboBoxBuilder>.FixedGroupTemplateId(string)ListBuilderBase<ComboBox, ComboBoxBuilder>.FixedGroupTemplateView(MvcHtmlString)ListBuilderBase<ComboBox, ComboBoxBuilder>.FixedGroupTemplateHandler(string)ListBuilderBase<ComboBox, ComboBoxBuilder>.FixedGroupTemplate<TModel>(TemplateBuilder<TModel>)ListBuilderBase<ComboBox, ComboBoxBuilder>.GroupTemplate(string)ListBuilderBase<ComboBox, ComboBoxBuilder>.GroupTemplateId(string)ListBuilderBase<ComboBox, ComboBoxBuilder>.GroupTemplateView(MvcHtmlString)ListBuilderBase<ComboBox, ComboBoxBuilder>.GroupTemplateHandler(string)ListBuilderBase<ComboBox, ComboBoxBuilder>.GroupTemplate<TModel>(TemplateBuilder<TModel>)ListBuilderBase<ComboBox, ComboBoxBuilder>.IgnoreCase(bool)ListBuilderBase<ComboBox, ComboBoxBuilder>.Height(int)ListBuilderBase<ComboBox, ComboBoxBuilder>.HeaderTemplate(string)ListBuilderBase<ComboBox, ComboBoxBuilder>.HeaderTemplateId(string)ListBuilderBase<ComboBox, ComboBoxBuilder>.HeaderTemplateView(MvcHtmlString)ListBuilderBase<ComboBox, ComboBoxBuilder>.HeaderTemplateHandler(string)ListBuilderBase<ComboBox, ComboBoxBuilder>.HeaderTemplate<TModel>(TemplateBuilder<TModel>)ListBuilderBase<ComboBox, ComboBoxBuilder>.FooterTemplate(string)ListBuilderBase<ComboBox, ComboBoxBuilder>.FooterTemplateId(string)ListBuilderBase<ComboBox, ComboBoxBuilder>.FooterTemplateView(MvcHtmlString)ListBuilderBase<ComboBox, ComboBoxBuilder>.FooterTemplateHandler(string)ListBuilderBase<ComboBox, ComboBoxBuilder>.FooterTemplate<TModel>(TemplateBuilder<TModel>)ListBuilderBase<ComboBox, ComboBoxBuilder>.NoDataTemplate(string)ListBuilderBase<ComboBox, ComboBoxBuilder>.NoDataTemplateId(string)ListBuilderBase<ComboBox, ComboBoxBuilder>.NoDataTemplateView(MvcHtmlString)ListBuilderBase<ComboBox, ComboBoxBuilder>.NoDataTemplateHandler(string)ListBuilderBase<ComboBox, ComboBoxBuilder>.NoDataTemplate<TModel>(TemplateBuilder<TModel>)ListBuilderBase<ComboBox, ComboBoxBuilder>.Popup(Action<PopupSettingsBuilder>)ListBuilderBase<ComboBox, ComboBoxBuilder>.ValuePrimitive(bool)ListBuilderBase<ComboBox, ComboBoxBuilder>.Virtual(bool)ListBuilderBase<ComboBox, ComboBoxBuilder>.Virtual(Action<VirtualSettingsBuilder>)ListBuilderBase<ComboBox, ComboBoxBuilder>.Label(Action<LabelSettingsBuilder>)ListBuilderBase<ComboBox, ComboBoxBuilder>.AdaptiveMode(AdaptiveMode)ListBuilderBase<ComboBox, ComboBoxBuilder>.AdaptiveTitle(string)ListBuilderBase<ComboBox, ComboBoxBuilder>.AdaptiveSubtitle(string)WidgetBuilderBase<ComboBox, ComboBoxBuilder>.ToComponent()WidgetBuilderBase<ComboBox, ComboBoxBuilder>.Name(string)WidgetBuilderBase<ComboBox, ComboBoxBuilder>.Deferred(bool)WidgetBuilderBase<ComboBox, ComboBoxBuilder>.ModelMetadata(ModelMetadata)WidgetBuilderBase<ComboBox, ComboBoxBuilder>.HtmlAttributes(object)WidgetBuilderBase<ComboBox, ComboBoxBuilder>.HtmlAttributes(IDictionary<string, object>)WidgetBuilderBase<ComboBox, ComboBoxBuilder>.AsModule(bool)WidgetBuilderBase<ComboBox, ComboBoxBuilder>.Render()WidgetBuilderBase<ComboBox, ComboBoxBuilder>.ScriptAttributes(object, bool)WidgetBuilderBase<ComboBox, ComboBoxBuilder>.ScriptAttributes(IDictionary<string, object>, bool)WidgetBuilderBase<ComboBox, ComboBoxBuilder>.ToHtmlString()WidgetBuilderBase<ComboBox, ComboBoxBuilder>.ToClientTemplate()WidgetBuilderBase<ComboBox, ComboBoxBuilder>.ToString()WidgetBuilderBase<ComboBox, ComboBoxBuilder>.Componentobject.GetType()object.MemberwiseClone()object.ToString()object.Equals(object)object.Equals(object, object)object.ReferenceEquals(object, object)object.GetHashCode()...

Constructors

Initializes a new instance of the ComboBoxBuilder class.

C#
public ComboBoxBuilder(ComboBox component)
Parameters:componentComboBox

The component.

Methods

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

C#
public ComboBoxBuilder AutoBind(bool autoBind)
Parameters:autoBindboolReturns:

ComboBoxBuilder

Example:
C#
@(Html.Kendo().ComboBox()
.Name("ComboBox")
.AutoBind(false)
)

Controls whether to adjust the popup width

C#
public ComboBoxBuilder AutoWidth(bool autoWidth)
Parameters:autoWidthboolReturns:

ComboBoxBuilder

Example:
C#
@(Html.Kendo().ComboBox()
.Name("ComboBox")
.AutoWidth(false)
)

Binds the ComboBox to a list of DropDownListItem.

C#
public ComboBoxBuilder BindTo(IEnumerable<DropDownListItem> dataSource)
Parameters:dataSourceIEnumerable<DropDownListItem>

The data source.

Returns:

ComboBoxBuilder

Example:
C#
@(Html.Kendo().ComboBox()
.Name("ComboBox")
.BindTo(new List&lt;DropDownListItem&gt;
{
new DropDownListItem {
Text = "Text1",
Value = "Value1"
},
new DropDownListItem {
Text = "Text2",
Value = "Value2"
} })
)

Binds the ComboBox to a list of SelectListItem.

C#
public ComboBoxBuilder BindTo(IEnumerable<SelectListItem> dataSource)
Parameters:dataSourceIEnumerable<SelectListItem>

The data source.

Returns:

ComboBoxBuilder

Example:
C#
@(Html.Kendo().ComboBox()
.Name("ComboBox")
.BindTo(new List&lt;SelectListItem&gt;
{
new SelectListItem{
Text = "Text1",
Value = "Value1"
},
new SelectListItem{
Text = "Text2",
Value = "Value2"
} })
)

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

C#
public ComboBoxBuilder CascadeFrom(string cascadeFrom)
Parameters:cascadeFromstring

The Id of the parent ComboBox.

Returns:

ComboBoxBuilder

Example:
C#
@(Html.Kendo().ComboBox()
.Name("ComboBox2")
.CascadeFrom("ComboBox1")
)

Sets the field used to filter the data source.

C#
public ComboBoxBuilder CascadeFromField(string cascadeFromField)
Parameters:cascadeFromFieldstring

The name of the field.

Returns:

ComboBoxBuilder

Example:
C#
@(Html.Kendo().ComboBox()
.Name("ComboBox2")
.CascadeFrom("ComboBox1")
.CascadeFromField("ParentID")
)

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

C#
public ComboBoxBuilder CascadeFromParentField(string cascadeFromParentField)
Parameters:cascadeFromParentFieldstring

The name of the field.

Returns:

ComboBoxBuilder

Example:
C#
@(Html.Kendo().ComboBox()
.Name("ComboBox2")
.CascadeFrom("ComboBox1")
.CascadeFromField("ParentID")
.CascadeFromParentField("ParentID")
)

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.

C#
public ComboBoxBuilder CascadeOnCustomValue()
Returns:

ComboBoxBuilder

Example:
C#
@(Html.Kendo().ComboBox()
.Name("ComboBox2")
.CascadeFrom("ComboBox1")
.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.

C#
public ComboBoxBuilder CascadeOnCustomValue(bool value)
Parameters:valuebool

If true, enables cascading from a custom value.

Returns:

ComboBoxBuilder

Example:
C#
@(Html.Kendo().ComboBox()
.Name("ComboBox2")
.CascadeFrom("ComboBox1")
.CascadeOnCustomValue(true)
)

Use to enable or disable clear button functionality.

C#
public ComboBoxBuilder ClearButton(bool enable)
Parameters:enablebool

The boolean value.

Returns:

ComboBoxBuilder

Example:
C#
@(Html.Kendo().ComboBox()
.Name("ComboBox")
.ClearButton(false)
)

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

C#
public ComboBoxBuilder DataValueField(string field)
Parameters:fieldstring

The name of the field.

Returns:

ComboBoxBuilder

Example:
C#
@(Html.Kendo().ComboBox()
.Name("ComboBox")
.DataTextField("Text")
.DataValueField("Value")
)

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.

C#
public ComboBoxBuilder EnforceMinLength(bool enforceMinLength)
Parameters:enforceMinLengthbool

The boolean value.

Returns:

ComboBoxBuilder

Example:
C#
@(Html.Kendo().ComboBox()
.Name("ComboBox")
.MinLength(3)
.Filter("contains")
.EnforceMinLength(true)
)

Configures the client-side events.

C#
public ComboBoxBuilder Events(Action<ComboBoxEventBuilder> clientEventsAction)
Parameters:clientEventsActionAction<ComboBoxEventBuilder>

The client events action.

Returns:

ComboBoxBuilder

Example:
C#
@(Html.Kendo().ComboBox()
.Name("ComboBox")
.Events(events =&gt;
events.Change("change")
)
)

Sets a value controlling how the color is applied.

C#
public ComboBoxBuilder FillMode(FillMode value)
Parameters:valueFillMode

The value for FillMode.

Returns:

ComboBoxBuilder

Example:
C#
@(Html.Kendo().ComboBox()
.Name("ComboBox")
.FillMode(FillMode.Solid)
)

Enables the filtering of items.

C#
public ComboBoxBuilder Filter(FilterType filter)
Parameters:filterFilterType

The type of filtering.

Returns:

ComboBoxBuilder

Example:
C#
@(Html.Kendo().ComboBox()
.Name("ComboBox")
.Filter(FilterType.Contains);
)

Enables the filtering of items.

C#
public ComboBoxBuilder Filter(string filter)
Parameters:filterstring

The type of filtering.

Returns:

ComboBoxBuilder

Example:
C#
@(Html.Kendo().ComboBox()
.Name("ComboBox")
.Filter("startswith");
)

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

C#
public ComboBoxBuilder HighlightFirst(bool highlightFirst)
Parameters:highlightFirstbool

If true, enables the highlighting.

Returns:

ComboBoxBuilder

Example:
C#
@(Html.Kendo().ComboBox()
.Name("ComboBox")
.HighlightFirst(true)
)

Defines the "inputmode" attribute of the inner <input /> element. The attribute specifies the type of on-screen keyboard displayed when the user focuses the input.

C#
public ComboBoxBuilder InputMode(string value)
Parameters:valuestring

The value that configures the "inputmode" attribute.

Returns:

ComboBoxBuilder

Example:
C#
@(Html.Kendo().ComboBox()
.Name("comboBox")
.InputMode("search")
)

Defines the items in the ComboBox

C#
public ComboBoxBuilder Items(Action<DropDownListItemFactory> addAction)
Parameters:addActionAction<DropDownListItemFactory>

The add action.

Returns:

ComboBoxBuilder

Example:
C#
@(Html.Kendo().ComboBox()
.Name("ComboBox")
.Items(items =&gt;
{
items.Add().Text("First Item");
items.Add().Text("Second Item");
})
)

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

C#
public ComboBoxBuilder Messages(Action<MessagesSettingsBuilder> configurator)
Parameters:configuratorAction<MessagesSettingsBuilder>

The action that configures the messages.

Returns:

ComboBoxBuilder

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

C#
public ComboBoxBuilder MinLength(int length)
Parameters:lengthint

The number of characters.

Returns:

ComboBoxBuilder

Example:
C#
@(Html.Kendo().ComboBox()
.Name("ComboBox")
.MinLength(3)
)

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

C#
public ComboBoxBuilder Placeholder(string placeholder)
Parameters:placeholderstring

The text that will appear as placeholder.

Returns:

ComboBoxBuilder

Example:
C#
@(Html.Kendo().ComboBox()
.Name("ComboBox")
.Placeholder("Select country...")
)

The configuration for the prefix adornment of the widget.

C#
public ComboBoxBuilder PrefixOptions(Action<PrefixOptionsSettingsBuilder> configurator)
Parameters:configuratorAction<PrefixOptionsSettingsBuilder>

The action that configures the prefix options.

Returns:

ComboBoxBuilder

If set to true, the widget will be readonly and will not allow user input. The widget is not readonly be default and allow user input.

C#
public ComboBoxBuilder Readonly(bool value)
Parameters:valuebool

The value for Readonly

Returns:

ComboBoxBuilder

Example:
C#
@(Html.Kendo().ComboBox()
.Name("ComboBox")
.Readonly(true);
)

Sets a value controlling the border radius.

C#
public ComboBoxBuilder Rounded(Rounded? value)
Parameters:valueRounded?

The value for Rounded.

Returns:

ComboBoxBuilder

Example:
C#
@(Html.Kendo().ComboBox()
.Name("ComboBox")
.Rounded(Rounded.Medium)
)

Sets the index of the item that will be selected.

C#
public ComboBoxBuilder SelectedIndex(int index)
Parameters:indexint

The index of the item.

Returns:

ComboBoxBuilder

Example:
C#
@(Html.Kendo().ComboBox()
.Name("ComboBox")
.SelectedIndex(0);
)

Sets the size of the component.

C#
public ComboBoxBuilder Size(ComponentSize? value)
Parameters:valueComponentSize?

The value for Size.

Returns:

ComboBoxBuilder

Example:
C#
@(Html.Kendo().ComboBox()
.Name("ComboBox")
.Size(ComponentSize.Medium)
)

The configuration for the suffix adornment of the widget.

C#
public ComboBoxBuilder SuffixOptions(Action<SuffixOptionsSettingsBuilder> configurator)
Parameters:configuratorAction<SuffixOptionsSettingsBuilder>

The action that configures the suffix options.

Returns:

ComboBoxBuilder

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

C#
public ComboBoxBuilder Suggest(bool suggest)
Parameters:suggestbool

If true, enables auto-type.

Returns:

ComboBoxBuilder

Example:
C#
@(Html.Kendo().ComboBox()
.Name("ComboBox")
.Suggest(true)
)

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

C#
public ComboBoxBuilder SyncValueAndText(bool syncValueAndText)
Parameters:syncValueAndTextboolReturns:

ComboBoxBuilder

Example:
C#
@(Html.Kendo().ComboBox()
.Name("ComboBox")
.SyncValueAndText(false)
)

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

C#
public ComboBoxBuilder Text(string text)
Parameters:textstring

The text to be shown in the input.

Returns:

ComboBoxBuilder

Example:
C#
@(Html.Kendo().ComboBox()
.Name("ComboBox")
.Text("Chai")
.AutoBind(false)
)