TreeViewCheckboxesBuilder

Methods

Enabled(System.Boolean)

Enables or disables the rendering of the checkboxes in the TreeView.

Parameters

enabled - System.Boolean

A boolean value that toggles the rendering of the checkboxes.

Example

Razor
 
             @(Html.Kendo().TreeView()
                        .Name("TreeView")
                        .Checkboxes(config => config
                            .Enabled(true)
                        )
             )
             

CheckChildren(System.Boolean)

Indicates whether the checkboxes of the child items must be checked when the checkbox of a parent item is checked.

Parameters

checkChildren - System.Boolean

A boolean value that enables or disables the CheckChildren option.

Example

Razor
 
             @( Html.Kendo().TreeView()
                        .Name("TreeView")
                        .Checkboxes(config => config
                            .CheckChildren(true)
                        )
            )
             

Template(System.String)

Defines the template that renders the checkboxes in the TreeView. The available fields in the template are: - item: The data item of the given node. - treeview: The TreeView options.

Parameters

template - System.String

Example

Razor
 
             @(Html.Kendo().TreeView()
                        .Name("TreeView")
                        .Checkboxes(checkboxes => checkboxes
                            .Name("checkedFiles")
                            .Template("<input type='checkbox' name='checkedFiles[#= item.id #]' value='true' />")
                        )
             )
             

TemplateHandler(System.String)

Defines the template that renders the checkboxes in the TreeView. The available fields in the template are: - item: The data item of the given node. - treeview: The TreeView options.

Parameters

template - System.String

The JavaScript function that will return the checkbox template.

Example

Razor
 
             @(Html.Kendo().TreeView()
                        .Name("TreeView")
                        .Checkboxes(checkboxes => checkboxes
                            .Name("checkedFiles")
                            .TemplateHandler("getCheckBoxTemplate")
                        )
             )
            <script>
                function getCheckBoxTemplate(data) {
                    return `<input type='checkbox' name='checkedFiles[${data.item.id}]' value='true' />`;
                }
            </script>
             

TemplateId(System.String)

Defines the template that renders the checkboxes in the TreeView. The available fields in the template are: - item: The data item of the given node. - treeview: The TreeView options.

Parameters

templateId - System.String

The "id" attribute of the external Kendo UI Template.

Example

Razor
 
             @(Html.Kendo().TreeView()
                        .Name("TreeView")
                        .Checkboxes(checkboxes => checkboxes
                            .Name("checkedFiles")
                            .TemplateId("checkBoxTemplate")
                        )
             )
            <script id="checkBoxTemplate" type="text/x-kendo-template">
                <input type='checkbox' name='checkedFiles[#= item.id #]' value='true' />
            </script>
             

TemplateView(System.Web.Mvc.MvcHtmlString)

Defines the template that renders the checkboxes in the TreeView. The available fields in the template are: - item: The data item of the given node. - treeview: The TreeView options.

Parameters

template - System.Web.Mvc.MvcHtmlString

The Razor View that contains the checkbox template.

Example

Razor
 
             @(Html.Kendo().TreeView()
                        .Name("TreeView")
                        .Checkboxes(checkboxes => checkboxes
                            .Name("checkedFiles")
                            .TemplateView(Html.Partial("TemplateView"))
                        )
             )
             

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

Defines the template that renders the checkboxes in the TreeView. The available fields in the template are: - item: The data item of the given node. - treeview: The TreeView options.

Parameters

template - TemplateBuilder<TModel>

A Template component that configures the checkbox template.

Example

Razor
 
             @(Html.Kendo().TreeView()
                        .Name("TreeView")
                        .Checkboxes(checkboxes => checkboxes
                            .Name("checkedFiles")
                            .Template(Html.Kendo().Template().AddHtml("<input type='checkbox' name='checkedFiles[${data.item.id}]' value='true' />"))
                        )
             )
             

Name(System.String)

Sets the "name" attribute of the checkbox inputs. The defined name will be posted to the server.

Parameters

name - System.String

The string that will be set as a "name" attribute.

Example

Razor
 
             @(Html.Kendo().TreeView()
                        .Name("TreeView")
                        .Checkboxes(config => config
                            .Name("checkedNodes")
                        )
             )