ListBoxBuilder
Methods
Selectable(Kendo.Mvc.UI.ListBoxSelectable)
Represents the selectable options.
Parameters
value - ListBoxSelectable
The value for Selectable
Example
@(Html.Kendo().ListBox()
.Name("listBox")
.Selectable(ListBoxSelectable.Single)
)
AutoBind(System.Boolean)
If set to false, the component will not bind to the data source during initialization. In this case, the data binding will occur when the change event of the data source is fired. By default, the ListBox will bind to the data source that is specified in the configuration.
Parameters
value - System.Boolean
The value that configures the autobind.
Example
@(Html.Kendo().ListBox()
.Name("listBox")
.AutoBind(true)
)
ConnectWith(System.String)
The id of the target ListBox to which items from the source ListBox will be transferred and vice versa. If you have to transfer items from the target ListBox over its toolbar, then you also need to set its connectWith option.
Parameters
value - System.String
The value that configures the connectwith.
Example
@(Html.Kendo().ListBox()
.Name("listBox")
.ConnectWith("Value")
)
DataTextField(System.String)
The field of the data item that provides the text content of the list items. Based on this field, the component filters the data source.
Parameters
value - System.String
The value that configures the datatextfield.
Example
@(Html.Kendo().ListBox()
.Name("listBox")
.DataTextField("Value")
)
DataValueField(System.String)
The field of the data item that provides the value of the component.
Parameters
value - System.String
The value that configures the datavaluefield.
Example
@(Html.Kendo().ListBox()
.Name("listBox")
.DataValueField("Value")
)
DropSources(System.String[])
Array of id strings which determines the ListBoxes that can drag and drop their items to the current ListBox. The dropSources option describes a one way relationship. If you want a two-way connection, then set the dropSources option on both components.
Parameters
value - System.String[]
The value that configures the dropsources.
Example
@(Html.Kendo().ListBox()
.Name("listBox")
.DropSources("Value 1", "Value 2")
)
Navigatable(System.Boolean)
Indicates whether the keyboard navigation is enabled or disabled.
Parameters
value - System.Boolean
The value that configures the navigatable.
Example
@(Html.Kendo().ListBox()
.Name("listBox")
.Navigatable(true)
)
Messages(System.Action)
Defines the localization texts for the ListBox. Used primarily for localization.
Parameters
configurator - System.Action<ListBoxMessagesSettingsBuilder>
The action that configures the messages.
Example
@(Html.Kendo().ListBox()
.Name("listBox")
.Messages(m => m.Tools(t=>t.MoveDown("Value")))
)
Template(System.String)
Specifies the item template of the ListBox.
Parameters
value - System.String
The value that configures the template.
Example
@(Html.Kendo().ListBox()
.Name("listBox")
.Template("Value")
)
TemplateId(System.String)
Specifies the item template of the ListBox.
Parameters
value - System.String
The value that configures the template.
Example
@(Html.Kendo().ListBox()
.Name("listBox")
.TemplateId("Value")
)
TemplateView(System.Web.Mvc.MvcHtmlString)
Specifies the item template of the ListBox.
Parameters
value - System.Web.Mvc.MvcHtmlString
The value that configures the template.
Example
@(Html.Kendo().ListBox()
.Name("listBox")
.TemplateView(Html.Partial("TemplateView"))
)
TemplateHandler(System.String)
Specifies the item template of the ListBox.
Parameters
value - System.String
The value that configures the template.
Example
@(Html.Kendo().ListBox()
.Name("listBox")
.TemplateHandler("Value")
)
Template(Kendo.Mvc.UI.TemplateBuilder)
Specifies the item template of the ListBox.
Parameters
template - TemplateBuilder<TModel>
A Template component that configures the template.
Example
@(Html.Kendo().ListBox()
.Name("listBox")
.Template(Html.Kendo().Template()
.AddHtml("<div class='ship-details'>")
.AddComponent(btn => btn
.Button()
.Name("button")
.Content("Details")
.ThemeColor(ThemeColor.Primary)
)
.AddHtml("</div>")
);
)
Toolbar(System.Action)
Defines the settings for displaying the toolbar of the ListBox. The toolbar allows you to execute a set of predefined actions.By default, the toolbar is not displayed. If the tools array is populated, then the toolbar and the corresponding tools are displayed.
Parameters
configurator - System.Action<ListBoxToolbarSettingsBuilder>
The action that configures the toolbar.
Example
@(Html.Kendo().ListBox()
.Name("listBox")
.Toolbar(toolbar =>
{
toolbar.Position(Kendo.Mvc.UI.Fluent.ListBoxToolbarPosition.Right);
})
)
Draggable()
Indicates whether the ListBox items can be dragged and dropped.
Example
@(Html.Kendo().ListBox()
.Name("listBox")
.Draggable()
)
Draggable(System.Boolean)
Indicates whether the ListBox items can be dragged and dropped.
Parameters
enabled - System.Boolean
Enables or disables the draggable option.
Example
@(Html.Kendo().ListBox()
.Name("listBox")
.Draggable(true)
)
Draggable(System.Action)
Indicates whether the ListBox items can be dragged and dropped.
Parameters
configurator - System.Action<ListBoxDraggableSettingsBuilder>
The action that configures the draggable.
Example
@(Html.Kendo().ListBox()
.Name("listBox")
.Draggable(d => d.Hint("Value"))
)
BindTo(System.Collections.IEnumerable)
Binds the ListBox to an IEnumerable list.
Parameters
data - System.Collections.IEnumerable
The data source.
Example
@(Html.Kendo().ListBox()
.Name("listBox")
.BindTo(ViewBag.Attendees)
)
BindTo(System.Collections.Generic.IEnumerable)
Binds the ListBox to a list of SelectListItem.
Parameters
dataSource - System.Collections.Generic.IEnumerable<SelectListItem>
The data source.
Example
@(Html.Kendo().ListBox()
.Name("listBox")
.BindTo(new List<SelectListItem>() {
new SelectListItem()
{
Text = "Cotton", Value = "1"
},
new SelectListItem()
{
Text = "Polyester", Value = "2"
}
})
)
DataSource(System.Action)
Sets the data source configuration of the ListBox.
Parameters
configurator - System.Action<ReadOnlyDataSourceBuilder>
The lambda which configures the data source
Example
@(Html.Kendo().ListBox()
.Name("listBox")
.DataSource(source => source
.Read(read => read.Action("GetCustomers", "ListBox"))
)
)
DataSource(System.String)
Sets the data source of the ListBox.
Parameters
dataSourceId - System.String
The name of the data source
Example
@(Html.Kendo().ListBox()
.Name("listBox")
.DataSource("dataSource")
)
Events(System.Action)
Configures the client-side events.
Parameters
configurator - System.Action<ListBoxEventBuilder>
The client events action.
Example
@( Html.Kendo().ListBox()
.Name("listBox")
.Events(events => events
.Change("handler")
)
)
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
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>
AsModule(System.Boolean)
Specifies whether the initialization script of the component will be rendered as a JavaScript module.
Parameters
value - System.Boolean
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();
)
ScriptAttributes(System.Object,System.Boolean)
Sets the JavaScript attributes to the initialization script.
Parameters
attributes - System.Object
The JavaScript attributes.
overrideAttributes - System.Boolean
Argument which determines whether attributes should be overriden.
ScriptAttributes(System.Collections.Generic.IDictionary,System.Boolean)
Sets the JavaScript attributes to the initialization script.
Parameters
attributes - System.Collections.Generic.IDictionary<String,Object>
The JavaScript attributes.
overrideAttributes - System.Boolean
Argument which determines whether attributes should be overriden.