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

Defines the fluent interface for configuring the DropDownList component.

Definition

Namespace:Kendo.Mvc.UI.Fluent

Assembly:Kendo.Mvc.dll

Syntax:

C#
public class DropDownListBuilder : DropDownListBuilderBase<DropDownList, DropDownListBuilder>, IHtmlString

Inheritance: objectWidgetBuilderBase<DropDownList, DropDownListBuilder>ListBuilderBase<DropDownList, DropDownListBuilder>DropDownListBuilderBase<DropDownList, DropDownListBuilder>DropDownListBuilder

Implements: IHtmlString

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

Constructors

C#
public DropDownListBuilder(DropDownList component)
Parameters:componentDropDownList

Methods

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

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

DropDownListBuilder

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

Controls whether to adjust the popup width

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

DropDownListBuilder

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

Binds the DropDownList to a list of DropDownListItem.

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

The data source.

Returns:

DropDownListBuilder

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

Binds the DropDownList to a list of SelectListItem.

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

The data source.

Returns:

DropDownListBuilder

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

Use it to set the Id of the parent DropDownList.

C#
public DropDownListBuilder CascadeFrom(string cascadeFrom)
Parameters:cascadeFromstringReturns:

DropDownListBuilder

Example:
C#
@(Html.Kendo().DropDownList()
.Name("DropDownList2")
.CascadeFrom("DropDownList1")
)

Use it to set the field used to filter the data source.

C#
public DropDownListBuilder CascadeFromField(string cascadeFromField)
Parameters:cascadeFromFieldstringReturns:

DropDownListBuilder

Example:
C#
@(Html.Kendo().DropDownList()
.Name("DropDownList2")
.CascadeFrom("DropDownList1")
.CascadeFromField("ParentID")
)

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

C#
public DropDownListBuilder CascadeFromParentField(string cascadeFromParentField)
Parameters:cascadeFromParentFieldstringReturns:

DropDownListBuilder

Example:
C#
@(Html.Kendo().DropDownList()
.Name("DropDownList2")
.CascadeFrom("DropDownList1")
.CascadeFromField("ParentID")
.CascadeFromParentField("ParentID")
)

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

C#
public DropDownListBuilder DataValueField(string field)
Parameters:fieldstringReturns:

DropDownListBuilder

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

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

C#
public DropDownListBuilder EnforceMinLength(bool enforceMinLength)
Parameters:enforceMinLengthboolReturns:

DropDownListBuilder

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

Configures the client-side events.

C#
public DropDownListBuilder Events(Action<DropDownListEventBuilder> clientEventsAction)
Parameters:clientEventsActionAction<DropDownListEventBuilder>

The client events action.

Returns:

DropDownListBuilder

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

Sets a value controlling how the color is applied.

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

The value for FillMode

Returns:

DropDownListBuilder

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

Use it to enable filtering of items.

C#
public DropDownListBuilder Filter(FilterType filter)
Parameters:filterFilterTypeReturns:

DropDownListBuilder

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

Use it to enable filtering of items.

C#
public DropDownListBuilder Filter(string filter)
Parameters:filterstringReturns:

DropDownListBuilder

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

When filtering is enabled, allows custom title to be defined for the filter input element.

C#
public DropDownListBuilder FilterTitle(string value)
Parameters:valuestring

The value for FilterTitle

Returns:

DropDownListBuilder

Example:
C#
@(Html.Kendo().DropDownList()
.Name("DropDownList")
.FilterTitle("MyFilter")
)

Defines the items in the DropDownList

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

The add action.

Returns:

DropDownListBuilder

Example:
C#
@(Html.Kendo().DropDownList()
.Name("DropDownList")
.Items(items =&gt;
{
items.Add().Text("First Item");
items.Add().Text("Second Item");
})
)
C#
public DropDownListBuilder Messages(Action<DropDownListMessagesSettingsBuilder> configurator)
Parameters:configuratorAction<DropDownListMessagesSettingsBuilder>Returns:

DropDownListBuilder

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

C#
public DropDownListBuilder MinLength(int length)
Parameters:lengthintReturns:

DropDownListBuilder

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

Define the object of the default empty item.

C#
public DropDownListBuilder OptionLabel(object optionLabel)
Parameters:optionLabelobjectReturns:

DropDownListBuilder

Example:
C#
@(Html.Kendo().DropDownList()
.Name("DropDownList")
.DataTextField("Text")
.DataValueField("Value")
.OptionLabel(new { Text = "Text1", Value = "Value1" })
)

Define the text of the default empty item.

C#
public DropDownListBuilder OptionLabel(string optionLabel)
Parameters:optionLabelstringReturns:

DropDownListBuilder

Example:
C#
@(Html.Kendo().DropDownList()
.Name("DropDownList")
.OptionLabel("Select country...")
)

OptionLabelTemplate to be used to render the option label content.

C#
public DropDownListBuilder OptionLabelTemplate(string optionLabelTemplate)
Parameters:optionLabelTemplatestringReturns:

DropDownListBuilder

Example:
C#
@(Html.Kendo().DropDownList()
.Name("DropDownList")
.OptionLabelTemplate("#= data #")
)

OptionLabelTemplateView to be used to render the option label content.

C#
public DropDownListBuilder OptionLabelTemplate<TModel>(TemplateBuilder<TModel> template)
Parameters:templateTemplateBuilder<TModel>

A Template component that configures the template.

Returns:

DropDownListBuilder

C#
public DropDownListBuilder OptionLabelTemplateHandler(string value)
Parameters:valuestringReturns:

DropDownListBuilder

OptionLabelTemplateId to be used to render the option label content.

C#
public DropDownListBuilder OptionLabelTemplateId(string optionLabelTemplateId)
Parameters:optionLabelTemplateIdstringReturns:

DropDownListBuilder

Example:
C#
@(Html.Kendo().DropDownList()
.Name("DropDownList")
.OptionLabelTemplateId("widgetOptionLabelTemplateId")
)

OptionLabelTemplateView to be used to render the option label content.

C#
public DropDownListBuilder OptionLabelTemplateView(MvcHtmlString optionLabelTemplateView)
Parameters:optionLabelTemplateViewMvcHtmlStringReturns:

DropDownListBuilder

Example:
C#
@(Html.Kendo().DropDownList()
.Name("DropDownList")
.OptionLabelTemplateView(Html.Partial("OptionLabelTemplate"))
)

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 DropDownListBuilder Readonly(bool value)
Parameters:valuebool

The value for Readonly

Returns:

DropDownListBuilder

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

Sets a value controlling the border radius.

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

The value for Rounded

Returns:

DropDownListBuilder

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

)

Use it to set selected item index

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

Item index.

Returns:

DropDownListBuilder

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

Sets the size of the component.

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

The value for Size

Returns:

DropDownListBuilder

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

Define the default item of the widget when the autoBind option is set to false.

C#
public DropDownListBuilder Text(object text)
Parameters:textobjectReturns:

DropDownListBuilder

Define the text of the widget, when the autoBind is set to false.

C#
public DropDownListBuilder Text(string text)
Parameters:textstringReturns:

DropDownListBuilder

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

ValueTemplate to be used to render the selected value.

C#
public DropDownListBuilder ValueTemplate(string valueTemplate)
Parameters:valueTemplatestringReturns:

DropDownListBuilder

Example:
C#
@(Html.Kendo().DropDownList()
.Name("DropDownList")
.ValueTemplate("#= data #")
)

ValueTemplateView to be used to render the selected value.

C#
public DropDownListBuilder ValueTemplate<TModel>(TemplateBuilder<TModel> template)
Parameters:templateTemplateBuilder<TModel>

A Template component that configures the template.

Returns:

DropDownListBuilder

The name of the JavaScript function that will return the template to be used to render the selected value.

C#
public DropDownListBuilder ValueTemplateHandler(string value)
Parameters:valuestringReturns:

DropDownListBuilder

ValueTemplateId to be used to render the selected value.

C#
public DropDownListBuilder ValueTemplateId(string valueTemplateId)
Parameters:valueTemplateIdstringReturns:

DropDownListBuilder

Example:
C#
@(Html.Kendo().DropDownList()
.Name("DropDownList")
.ValueTemplateId("widgetValueTemplateId")
)

ValueTemplateView to be used to render the selected value.

C#
public DropDownListBuilder ValueTemplateView(MvcHtmlString valueTemplateView)
Parameters:valueTemplateViewMvcHtmlStringReturns:

DropDownListBuilder

Example:
C#
@(Html.Kendo().DropDownList()
.Name("DropDownList")
.ValueTemplateView(Html.Partial("ValueTemplate"))
)