Kendo.Mvc.UI.Fluent.DropDownListBuilder
Defines the fluent interface for configuring the DropDownList component.
Methods
AutoBind(System.Boolean)
Controls whether to bind the widget to the DataSource on initialization.
Example (ASPX)
<%= Html.Kendo().DropDownList()
.Name("DropDownList")
.AutoBind(false)
%>
AutoWidth(System.Boolean)
Controls whether to adjust the popup width
Example (ASPX)
<%= Html.Kendo().DropDownList()
.Name("DropDownList")
.AutoWidth(false)
%>
BindTo(System.Collections.Generic.IEnumerable<Kendo.Mvc.UI.DropDownListItem>)
Binds the DropDownList to a list of DropDownListItem.
Parameters
dataSource System.Collections.Generic.IEnumerable<Kendo.Mvc.UI.DropDownListItem>
The data source.
Example (ASPX)
<%: Html.Telerik().DropDownList()
.Name("DropDownList")
.BindTo(new List<DropDownListItem>
{
new DropDownListItem{
Text = "Text1",
Value = "Value1"
},
new DropDownListItem{
Text = "Text2",
Value = "Value2"
}
})
%>
BindTo(System.Collections.Generic.IEnumerable<System.Web.Mvc.SelectListItem>)
Binds the DropDownList to a list of SelectListItem.
Parameters
dataSource System.Collections.Generic.IEnumerable<System.Web.Mvc.SelectListItem>
The data source.
Example (ASPX)
<%: Html.Telerik().DropDownList()
.Name("DropDownList")
.BindTo(new List<SelectListItem>
{
new SelectListItem{
Text = "Text1",
Value = "Value1"
},
new SelectListItem{
Text = "Text2",
Value = "Value2"
}
})
%>
DataValueField(System.String)
Sets the field of the data item that provides the value content of the list items.
Example (ASPX)
<%= 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.
Example (ASPX)
<%= Html.Kendo().DropDownList()
.Name("DropDownList")
.MinLength(3)
.Filter("contains")
.EnforceMinLength(true)
%>
Events(System.Action<Kendo.Mvc.UI.Fluent.DropDownListEventBuilder>)
Configures the client-side events.
Parameters
clientEventsAction System.Action<Kendo.Mvc.UI.Fluent.DropDownListEventBuilder>
The client events action.
Example (ASPX)
<%= Html.Kendo().DropDownList()
.Name("DropDownList")
.Events(events =>
events.Change("change")
)
%>
Filter(System.String)
Use it to enable filtering of items.
Example (ASPX)
<%= Html.Kendo().DropDownList()
.Name("DropDownList")
.Filter("startswith");
%>
Filter(Kendo.Mvc.UI.FilterType)
Use it to enable filtering of items.
Example (ASPX)
<%= Html.Kendo().DropDownList()
.Name("DropDownList")
.Filter(FilterType.Contains);
%>
Items(System.Action<Kendo.Mvc.UI.Fluent.DropDownListItemFactory>)
Defines the items in the DropDownList
Parameters
addAction System.Action<Kendo.Mvc.UI.Fluent.DropDownListItemFactory>
The add action.
Example (ASPX)
<%= Html.Telerik().DropDownList()
.Name("DropDownList")
.Items(items =>
{
items.Add().Text("First Item");
items.Add().Text("Second Item");
})
%>
Messages(System.Action<Kendo.Mvc.UI.Fluent.DropDownListMessagesSettingsBuilder>)
The text messages displayed in the widget. Use it to customize or localize the messages.
Parameters
configurator System.Action<Kendo.Mvc.UI.Fluent.DropDownListMessagesSettingsBuilder>
The action that configures the messages.
OptionLabel(System.String)
Define the text of the default empty item.
Example (ASPX)
<%= Html.Kendo().DropDownList()
.Name("DropDownList")
.OptionLabel("Select country...")
%>
OptionLabel(System.Object)
Define the object of the default empty item.
Example (ASPX)
<%= Html.Kendo().DropDownList()
.Name("DropDownList")
.DataTextField("Text")
.DataValueField("Value")
.OptionLabel(new { Text = "Text1", Value = "Value1" })
%>
MinLength(System.Int32)
Specifies the minimum number of characters that should be typed before the widget queries the dataSource.
Example (ASPX)
<%= Html.Kendo().DropDownList()
.Name("DropDownList")
.MinLength(3)
%>
SelectedIndex(System.Int32)
Use it to set selected item index
Parameters
index System.Int32
Item index.
Example (ASPX)
<%= Html.Kendo().DropDownList()
.Name("DropDownList")
.SelectedIndex(0);
%>
CascadeFrom(System.String)
Use it to set the Id of the parent DropDownList.
Example (ASPX)
<%= Html.Telerik().DropDownList()
.Name("DropDownList2")
.CascadeFrom("DropDownList1")
%>
CascadeFromField(System.String)
Use it to set the field used to filter the data source.
Example (ASPX)
<%= Html.Telerik().DropDownList()
.Name("DropDownList2")
.CascadeFrom("DropDownList1")
.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 dataSource.
Example (ASPX)
<%= Html.Telerik().DropDownList()
.Name("DropDownList2")
.CascadeFrom("DropDownList1")
.CascadeFromField("ParentID")
.CascadeFromParentField("ParentID")
%>
Text(System.String)
Define the text of the widget, when the autoBind is set to false.
Example (ASPX)
<%= Html.Telerik().DropDownList()
.Name("DropDownList")
.Text("Chai")
.AutoBind(false)
%>
Text(System.Object)
Define the default item of the widget when the autoBind option is set to false.
OptionLabelTemplate(System.String)
OptionLabelTemplate to be used to render the option label content.
Example (ASPX)
<%= Html.Kendo().DropDownList()
.Name("DropDownList")
.OptionLabelTemplate("#= data #")
%>
OptionLabelTemplateId(System.String)
OptionLabelTemplateId to be used to render the option label content.
Example (ASPX)
<%= Html.Kendo().DropDownList()
.Name("DropDownList")
.OptionLabelTemplateId("widgetOptionLabelTemplateId")
%>
ValueTemplate(System.String)
ValueTemplate to be used to render the selected value.
Example (ASPX)
<%= Html.Kendo().DropDownList()
.Name("DropDownList")
.ValueTemplate("#= data #")
%>
ValueTemplateId(System.String)
ValueTemplateId to be used to render the selected value.
Example (ASPX)
<%= Html.Kendo().DropDownList()
.Name("DropDownList")
.ValueTemplateId("widgetValueTemplateId")
%>
FilterTitle(System.String)
When filtering is enabled, allows custom title to be defined for the filter input element.
Parameters
value System.String
The value for FilterTitle
Size(Kendo.Mvc.UI.ComponentSize)
Sets the size of the component.
Parameters
value Kendo.Mvc.UI.ComponentSize
The value for Size
Rounded(Kendo.Mvc.UI.Rounded)
Sets a value controlling the border radius.
Parameters
value Kendo.Mvc.UI.Rounded
The value for Rounded
FillMode(Kendo.Mvc.UI.FillMode)
Sets a value controlling how the color is applied.
Parameters
value Kendo.Mvc.UI.FillMode
The value for FillMode