New to Telerik UI for ASP.NET MVC? Start a free 30-day trial

Defines the fluent interface for configuring child TreeView items.

Definition

Namespace:Kendo.Mvc.UI.Fluent

Assembly:Kendo.Mvc.dll

Syntax:

C#
public class TreeViewCheckboxesBuilder

Inheritance: objectTreeViewCheckboxesBuilder

Inherited Members object.GetType()object.MemberwiseClone()object.ToString()object.Equals(object)object.Equals(object, object)object.ReferenceEquals(object, object)object.GetHashCode()...

Constructors

Initializes a new instance of the TreeViewCheckboxesBuilder class.

C#
public TreeViewCheckboxesBuilder(TreeViewCheckboxesSettings settings)
Parameters:settingsTreeViewCheckboxesSettings

The checkbox settings.

Methods

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

C#
public virtual TreeViewCheckboxesBuilder CheckChildren(bool checkChildren)
Parameters:checkChildrenbool

A boolean value that enables or disables the CheckChildren option.

Returns:

TreeViewCheckboxesBuilder

Example:
C#
@( Html.Kendo().TreeView()
.Name("TreeView")
.Checkboxes(config => config
.CheckChildren(true)
)
)

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

C#
public virtual TreeViewCheckboxesBuilder Enabled(bool enabled)
Parameters:enabledbool

A boolean value that toggles the rendering of the checkboxes.

Returns:

TreeViewCheckboxesBuilder

Example:
C#
@(Html.Kendo().TreeView()
.Name("TreeView")
.Checkboxes(config => config
.Enabled(true)
)
)

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

C#
public TreeViewCheckboxesBuilder Name(string name)
Parameters:namestring

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

Returns:

TreeViewCheckboxesBuilder

Example:
C#
@(Html.Kendo().TreeView()
.Name("TreeView")
.Checkboxes(config => config
.Name("checkedNodes")
)
)

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.
C#
public TreeViewCheckboxesBuilder Template(string template)
Parameters:templatestringReturns:

TreeViewCheckboxesBuilder

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

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.
C#
public TreeViewCheckboxesBuilder Template<TModel>(TemplateBuilder<TModel> template)
Parameters:templateTemplateBuilder<TModel>

A Template component that configures the checkbox template.

Returns:

TreeViewCheckboxesBuilder

Example:
C#
@(Html.Kendo().TreeView()
.Name("TreeView")
.Checkboxes(checkboxes =&gt; checkboxes
.Name("checkedFiles")
.Template(Html.Kendo().Template().AddHtml("&lt;input type='checkbox' name='checkedFiles[${data.item.id}]' value='true' /&gt;"))
)
)

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.
C#
public TreeViewCheckboxesBuilder TemplateHandler(string template)
Parameters:templatestring

The JavaScript function that will return the checkbox template.

Returns:

TreeViewCheckboxesBuilder

Example:
C#
@(Html.Kendo().TreeView()
.Name("TreeView")
.Checkboxes(checkboxes =&gt; checkboxes
.Name("checkedFiles")
.TemplateHandler("getCheckBoxTemplate")
)
)
&lt;script&gt;
function getCheckBoxTemplate(data) {
return `&lt;input type='checkbox' name='checkedFiles[${data.item.id}]' value='true' /&gt;`;
}
&lt;/script&gt;

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.
C#
public TreeViewCheckboxesBuilder TemplateId(string templateId)
Parameters:templateIdstring

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

Returns:

TreeViewCheckboxesBuilder

Example:
C#
@(Html.Kendo().TreeView()
.Name("TreeView")
.Checkboxes(checkboxes =&gt; checkboxes
.Name("checkedFiles")
.TemplateId("checkBoxTemplate")
)
)
&lt;script id="checkBoxTemplate" type="text/x-kendo-template"&gt;
&lt;input type='checkbox' name='checkedFiles[#= item.id #]' value='true' /&gt;
&lt;/script&gt;

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.
C#
public TreeViewCheckboxesBuilder TemplateView(MvcHtmlString template)
Parameters:templateMvcHtmlString

The Razor View that contains the checkbox template.

Returns:

TreeViewCheckboxesBuilder

Example:
C#
@(Html.Kendo().TreeView()
.Name("TreeView")
.Checkboxes(checkboxes =&gt; checkboxes
.Name("checkedFiles")
.TemplateView(Html.Partial("TemplateView"))
)
)