# ListBoxBuilder

## Properties

### WriteAction - Func

## Methods

### BindTo(System.Collections.IEnumerable)

Binds the ListBox to an IEnumerable list.

#### Parameters

##### data - `System.Collections.IEnumerable`

The data source.

#### RETURNS

Returns the current [ListBoxBuilder](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui.fluent/listboxbuilder) instance.

#### 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.

#### RETURNS

Returns the current [ListBoxBuilder](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui.fluent/listboxbuilder) instance.

#### 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](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui.fluent/readonlydatasourcebuilder)>

The lambda which configures the data source

#### RETURNS

Returns the current [ListBoxBuilder](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui.fluent/listboxbuilder) instance.

#### 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

#### RETURNS

Returns the current [ListBoxBuilder](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui.fluent/listboxbuilder) instance.

#### Example

```
 
            @(Html.Kendo().ListBox()
                .Name("listBox")
                .DataSource("dataSource")
            )
             
```

### AutoBind(System.Boolean)

If set to false, the widget 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 for AutoBind

#### RETURNS

Returns the current [ListBoxBuilder](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui.fluent/listboxbuilder) instance.

#### 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 for ConnectWith

#### RETURNS

Returns the current [ListBoxBuilder](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui.fluent/listboxbuilder) instance.

#### 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 widget filters the data source.

#### Parameters

##### value - `System.String`

The value for DataTextField

#### RETURNS

Returns the current [ListBoxBuilder](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui.fluent/listboxbuilder) instance.

#### Example

```
 
            @(Html.Kendo().ListBox()
                .Name("listBox")
                .DataTextField("Value")
            )
             
```

### DataValueField(System.String)

The field of the data item that provides the value of the widget.

#### Parameters

##### value - `System.String`

The value for DataValueField

#### RETURNS

Returns the current [ListBoxBuilder](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui.fluent/listboxbuilder) instance.

#### Example

```
 
            @(Html.Kendo().ListBox()
                .Name("listBox")
                .DataValueField("Value")
            )
             
```

### Draggable(System.Action)

Indicates whether the ListBox items can be dragged and dropped.

#### Parameters

##### configurator - System.Action<[ListBoxDraggableSettingsBuilder](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui.fluent/listboxdraggablesettingsbuilder)>

The configurator for the draggable setting.

#### RETURNS

Returns the current instance of [ListBoxBuilder](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui.fluent/listboxbuilder) .

### Draggable()

Indicates whether the ListBox items can be dragged and dropped.

#### RETURNS

Returns the current instance of [ListBoxBuilder](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui.fluent/listboxbuilder) .

### Draggable(System.Boolean)

Indicates whether the ListBox items can be dragged and dropped.

#### Parameters

##### enabled - `System.Boolean`

Enables or disables the draggable option.

#### RETURNS

Returns the current instance of [ListBoxDraggableSettingsBuilder](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui.fluent/listboxdraggablesettingsbuilder) .

### 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 widgets.

#### Parameters

##### value - `System.String[]`

The value for DropSources

#### RETURNS

Returns the current [ListBoxBuilder](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui.fluent/listboxbuilder) instance.

#### 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 for Navigatable

#### RETURNS

Returns the current [ListBoxBuilder](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui.fluent/listboxbuilder) instance.

#### 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](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui.fluent/listboxmessagessettingsbuilder)>

The configurator for the messages setting.

#### RETURNS

Returns the current instance of [ListBoxBuilder](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui.fluent/listboxbuilder) .

### Template(System.String)

Specifies the item template of the ListBox.

#### Parameters

##### value - `System.String`

The value for Template

#### RETURNS

Returns the current [ListBoxBuilder](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui.fluent/listboxbuilder) instance.

#### 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>")
             );
            )
             
```

### TemplateId(System.String)

Specifies the item template of the ListBox.

#### Parameters

##### templateId - `System.String`

The ID of the template element for Template

#### RETURNS

Returns the current [ListBoxBuilder](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui.fluent/listboxbuilder) instance.

#### Example

```
 
            @(Html.Kendo().ListBox()
                .Name("listBox")
                .TemplateId("Value")
            )
             
```

### TemplateView(Microsoft.AspNetCore.Html.IHtmlContent)

Specifies the item template of the ListBox.

#### Parameters

##### templateView - `Microsoft.AspNetCore.Html.IHtmlContent`

The view that contains the template for Template

#### RETURNS

Returns the current [ListBoxBuilder](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui.fluent/listboxbuilder) instance.

#### Example

```
 
            @(Html.Kendo().ListBox()
                .Name("listBox")
                .TemplateView(Html.Partial("TemplateView"))
            )
             
```

### TemplateHandler(System.String)

Specifies the item template of the ListBox.

#### Parameters

##### templateHandler - `System.String`

The handler that returs the template for Template

#### RETURNS

Returns the current [ListBoxBuilder](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui.fluent/listboxbuilder) instance.

#### Example

```
 
            @(Html.Kendo().ListBox()
                .Name("listBox")
                .TemplateHandler("Value")
            )
             
```

### Template(Kendo.Mvc.UI.Fluent.TemplateBuilder)

Specifies the item template of the ListBox.

#### Parameters

##### template - TemplateBuilder\<TModel>

A Template component that configures the template.

#### RETURNS

Returns the current [ListBoxBuilder](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui.fluent/listboxbuilder) instance.

### 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](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui.fluent/listboxtoolbarsettingsbuilder)>

The configurator for the toolbar setting.

#### RETURNS

Returns the current instance of [ListBoxBuilder](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui.fluent/listboxbuilder) .

### Selectable(Kendo.Mvc.UI.ListBoxSelectable)

Represents the selectable options.

#### Parameters

##### value - [ListBoxSelectable](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/listboxselectable)

The value for Selectable

#### RETURNS

Returns the current [ListBoxBuilder](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui.fluent/listboxbuilder) instance.

#### Example

```
 
            @(Html.Kendo().ListBox()
                .Name("listBox")
                .Selectable(ListBoxSelectable.Single)
            )
             
```

### Events(System.Action)

Configures the client-side events.

#### Parameters

##### configurator - System.Action<[ListBoxEventBuilder](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui.fluent/listboxeventbuilder)>

The client events action.

#### RETURNS

Returns the current [ListBoxBuilder](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui.fluent/listboxbuilder) instance.

#### Example

```
 
            @(Html.Kendo().ListBox()
                  .Name("ListBox")
                  .Events(events => events
                      .Add("onAdd")
                  )
            )
             
```

### ToComponent()

Returns the internal view component.

#### RETURNS

The  instance that represents the component.

### Expression(System.String)

Sets the name of the component.

#### Parameters

##### modelExpression - `System.String`

The name.

#### RETURNS

Returns the current  instance.

### Explorer(Microsoft.AspNetCore.Mvc.ViewFeatures.ModelExplorer)

Sets the name of the component.

#### Parameters

##### modelExplorer - `Microsoft.AspNetCore.Mvc.ViewFeatures.ModelExplorer`

The name.

#### RETURNS

Returns the current  instance.

### Name(System.String)

Sets the name of the component.

#### Parameters

##### componentName - `System.String`

The name.

#### RETURNS

Returns the current  instance.

### Deferred(System.Boolean)

Suppress initialization script rendering. Note that this options should be used in conjunction with Kendo.Mvc.UI.Fluent.WidgetFactory.DeferredScripts(System.Boolean,System.Boolean)

#### Parameters

##### deferred - `System.Boolean`

#### RETURNS

Returns a [DeferredWidgetBuilder](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui.fluent/deferredwidgetbuilder) instance.

### HtmlAttributes(System.Object)

Sets the HTML attributes.

#### Parameters

##### attributes - `System.Object`

The HTML attributes.

#### RETURNS

Returns the current  instance.

### HtmlAttributes(System.Collections.Generic.IDictionary)

Sets the HTML attributes.

#### Parameters

##### attributes - `System.Collections.Generic.IDictionary<String,Object>`

The HTML attributes.

#### RETURNS

Returns the current  instance.

### 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.

#### RETURNS

Returns the current  instance.

### 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.

#### RETURNS

Returns the current  instance.

### Render()

Renders the component in place.

### ToHtmlString()

Returns the HTML representation of the component.

### WriteTo(System.IO.TextWriter,System.Text.Encodings.Web.HtmlEncoder)

#### Parameters

##### writer - `System.IO.TextWriter`

##### encoder - `System.Text.Encodings.Web.HtmlEncoder`

### ToClientTemplate()

Returns the client template for the component.

### AsModule(System.Boolean)

Specifies whether the initialization script of the component will be rendered as a JavaScript module.

#### Parameters

##### value - `System.Boolean`

#### RETURNS

Returns the current  instance.
