DropDownListBuilder

Methods

AutoBind(System.Boolean)

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

Parameters

autoBind - System.Boolean

Example

Razor
 
             @(Html.Kendo().DropDownList()
                        .Name("DropDownList")
                        .AutoBind(false)
             )
             

AutoWidth(System.Boolean)

Controls whether to adjust the popup width

Parameters

autoWidth - System.Boolean

Example

Razor
 
             @(Html.Kendo().DropDownList()
                        .Name("DropDownList")
                        .AutoWidth(false)
             )
             

BindTo(System.Collections.Generic.IEnumerable)

Binds the DropDownList to a list of DropDownListItem.

Parameters

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

The data source.

Example

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

BindTo(System.Collections.Generic.IEnumerable)

Binds the DropDownList to a list of DropDownListItem.

Parameters

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

The data source.

Example

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

DataValueField(System.String)

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

Parameters

field - System.String

Example

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

EnforceMinLength(System.Boolean)

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.

Parameters

enforceMinLength - System.Boolean

Example

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

Events(System.Action)

Configures the client-side events.

Parameters

clientEventsAction - System.Action<DropDownListEventBuilder>

The client events action.

Example

Razor