ASP.NET MVC - EJ2

  • Code Examples
  • Upgrade Guide
  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Class TreeViewBuilder

    Show / Hide Table of Contents

    Class TreeViewBuilder

    Inheritance
    System.Object
    ControlBuilder
    TreeViewBuilder
    Inherited Members
    ControlBuilder.Context
    System.Object.ToString()
    System.Object.Equals(System.Object)
    System.Object.Equals(System.Object, System.Object)
    System.Object.ReferenceEquals(System.Object, System.Object)
    System.Object.GetHashCode()
    System.Object.GetType()
    System.Object.MemberwiseClone()
    Namespace: Syncfusion.EJ2.Navigations
    Assembly: Syncfusion.EJ2.dll
    Syntax
    public class TreeViewBuilder : ControlBuilder

    Constructors

    TreeViewBuilder()

    Declaration
    public TreeViewBuilder()

    TreeViewBuilder(TreeView)

    Declaration
    public TreeViewBuilder(TreeView model)
    Parameters
    Type Name Description
    TreeView model

    Fields

    model

    Declaration
    public TreeView model
    Field Value
    Type Description
    TreeView

    Properties

    HtmlAttr

    Declaration
    public IDictionary<string, object> HtmlAttr { get; set; }
    Property Value
    Type Description
    System.Collections.Generic.IDictionary<System.String, System.Object>

    ID

    Declaration
    public string ID { get; set; }
    Property Value
    Type Description
    System.String

    Output

    Declaration
    public override TextWriter Output { get; set; }
    Property Value
    Type Description
    System.IO.TextWriter
    Overrides
    ControlBuilder.Output

    Methods

    ActionFailure(String)

    Event callback that is raised while any TreeView action failed to fetch the desired results.

    Declaration
    public TreeViewBuilder ActionFailure(string actionFailure)
    Parameters
    Type Name Description
    System.String actionFailure
    Returns
    Type Description
    TreeViewBuilder

    AllowDragAndDrop(Boolean)

    Indicates whether the TreeView allows drag and drop of nodes. To drag and drop a node in desktop, hold the mouse on the node, drag it to the target node and drop the node by releasing the mouse. For touch devices, drag and drop operation is performed by touch, touch move and touch end. For more information on drag and drop nodes concept, refer to Drag and Drop.

    Declaration
    public TreeViewBuilder AllowDragAndDrop(bool allowDragAndDrop = true)
    Parameters
    Type Name Description
    System.Boolean allowDragAndDrop
    Returns
    Type Description
    TreeViewBuilder

    AllowEditing(Boolean)

    Enables or disables editing of the text in the TreeView node. When allowEditing property is set to true, the TreeView allows you to edit the node by double clicking the node or by navigating to the node and pressing F2 key. For more information on node editing, refer to Node Editing.

    Declaration
    public TreeViewBuilder AllowEditing(bool allowEditing = true)
    Parameters
    Type Name Description
    System.Boolean allowEditing
    Returns
    Type Description
    TreeViewBuilder

    AllowMultiSelection(Boolean)

    Enables or disables multi-selection of nodes. To select multiple nodes: Select the nodes by holding down the Ctrl key while clicking on the nodes. Select consecutive nodes by clicking the first node to select and hold down the Shift key and click the last node to select.

    Declaration
    public TreeViewBuilder AllowMultiSelection(bool allowMultiSelection = true)
    Parameters
    Type Name Description
    System.Boolean allowMultiSelection
    Returns
    Type Description
    TreeViewBuilder

    AllowTextWrap(Boolean)

    Enables or disables text wrapping when text exceeds the bounds in the TreeView node. When the allowTextWrap property is set to true, the TreeView node text content will wrap to the next line when it exceeds the width of the TreeView node. The TreeView node height will be adjusted automatically based on the TreeView node content.

    Declaration
    public TreeViewBuilder AllowTextWrap(bool allowTextWrap = true)
    Parameters
    Type Name Description
    System.Boolean allowTextWrap
    Returns
    Type Description
    TreeViewBuilder

    Animation(TreeViewNodeAnimationSettings)

    Specifies the type of animation applied on expanding and collapsing the nodes along with duration.

    Declaration
    public TreeViewBuilder Animation(TreeViewNodeAnimationSettings animation)
    Parameters
    Type Name Description
    TreeViewNodeAnimationSettings animation
    Returns
    Type Description
    TreeViewBuilder

    Animation(Action<TreeViewNodeAnimationSettingsBuilder>)

    Declaration
    public TreeViewBuilder Animation(Action<TreeViewNodeAnimationSettingsBuilder> animation)
    Parameters
    Type Name Description
    System.Action<TreeViewNodeAnimationSettingsBuilder> animation
    Returns
    Type Description
    TreeViewBuilder

    AutoCheck(Boolean)

    Allow us to specify the parent and child nodes to get auto check while we check or uncheck a node.

    Declaration
    public TreeViewBuilder AutoCheck(bool autoCheck = true)
    Parameters
    Type Name Description
    System.Boolean autoCheck
    Returns
    Type Description
    TreeViewBuilder

    CheckedNodes(String[])

    The checkedNodes property is used to set the nodes that need to be checked. This property returns the checked nodes ID in the TreeView component. The checkedNodes property depends upon the value of showCheckBox property. For more information on checkedNodes, refer to checkedNodes.

    Declaration
    public TreeViewBuilder CheckedNodes(string[] checkedNodes)
    Parameters
    Type Name Description
    System.String[] checkedNodes
    Returns
    Type Description
    TreeViewBuilder

    Created(String)

    Event callback that is raised when the TreeView component is created successfully.

    Declaration
    public TreeViewBuilder Created(string created)
    Parameters
    Type Name Description
    System.String created
    Returns
    Type Description
    TreeViewBuilder

    CssClass(String)

    Specifies one or more than one CSS classes to be added with root element of the TreeView to help customize the appearance of the component.

    Declaration
    public TreeViewBuilder CssClass(string cssClass)
    Parameters
    Type Name Description
    System.String cssClass
    Returns
    Type Description
    TreeViewBuilder

    DataBound(String)

    Event callback that is raised when data source is populated in the TreeView.

    Declaration
    public TreeViewBuilder DataBound(string dataBound)
    Parameters
    Type Name Description
    System.String dataBound
    Returns
    Type Description
    TreeViewBuilder

    DataSourceChanged(String)

    Event callback that is raised when data source is changed in the TreeView. The data source will be changed after performing some operation like drag and drop, node editing, adding and removing node.

    Declaration
    public TreeViewBuilder DataSourceChanged(string dataSourceChanged)
    Parameters
    Type Name Description
    System.String dataSourceChanged
    Returns
    Type Description
    TreeViewBuilder

    Destroyed(String)

    Event callback that is raised when the TreeView control is destroyed successfully.

    Declaration
    public TreeViewBuilder Destroyed(string destroyed)
    Parameters
    Type Name Description
    System.String destroyed
    Returns
    Type Description
    TreeViewBuilder

    Disabled(Boolean)

    Specifies a value that indicates whether the TreeView component is disabled or not. When set to true, user interaction will not be occurred in TreeView.

    Declaration
    public TreeViewBuilder Disabled(bool disabled = true)
    Parameters
    Type Name Description
    System.Boolean disabled
    Returns
    Type Description
    TreeViewBuilder

    DragArea(String)

    Specifies the target in which the draggable element can be moved and dropped. By default, the draggable element movement occurs in the page.

    Declaration
    public TreeViewBuilder DragArea(string dragArea)
    Parameters
    Type Name Description
    System.String dragArea
    Returns
    Type Description
    TreeViewBuilder

    DrawNode(String)

    Event callback that is raised before the TreeView node is appended to the TreeView element. It helps to customize specific nodes.

    Declaration
    public TreeViewBuilder DrawNode(string drawNode)
    Parameters
    Type Name Description
    System.String drawNode
    Returns
    Type Description
    TreeViewBuilder

    EnableHtmlSanitizer(Boolean)

    Specifies whether to allow rendering of untrusted HTML values in the TreeView component. While enable this property, it sanitize suspected untrusted strings and script, and update in the TreeView component.

    Declaration
    public TreeViewBuilder EnableHtmlSanitizer(bool enableHtmlSanitizer = true)
    Parameters
    Type Name Description
    System.Boolean enableHtmlSanitizer
    Returns
    Type Description
    TreeViewBuilder

    EnablePersistence(Boolean)

    Enables or disables persisting TreeView state between page reloads. If enabled, following APIs will persist.

    1. selectedNodes - Represents the nodes that are selected in the TreeView component.
    2. checkedNodes - Represents the nodes that are checked in the TreeView component.
    3. expandedNodes - Represents the nodes that are expanded in the TreeView component.
    Declaration
    public TreeViewBuilder EnablePersistence(bool enablePersistence = true)
    Parameters
    Type Name Description
    System.Boolean enablePersistence
    Returns
    Type Description
    TreeViewBuilder

    EnableRtl(Boolean)

    Enable or disable rendering component in right to left direction.

    Declaration
    public TreeViewBuilder EnableRtl(bool enableRtl = true)
    Parameters
    Type Name Description
    System.Boolean enableRtl
    Returns
    Type Description
    TreeViewBuilder

    ExpandedNodes(String[])

    Represents the expanded nodes in the TreeView component. We can set the nodes that need to be expanded or get the ID of the nodes that are currently expanded by using this property.

    Declaration
    public TreeViewBuilder ExpandedNodes(string[] expandedNodes)
    Parameters
    Type Name Description
    System.String[] expandedNodes
    Returns
    Type Description
    TreeViewBuilder

    ExpandOn(ExpandOnSettings)

    Specifies the action on which the node expands or collapses. The available actions : Click - The expand/collapse operation happens when you single-click on the node in desktop. DblClick - The expand/collapse operation happens when you double-click on the node in desktop. None - The expand/collapse operation will not happen. In mobile devices, the node expand/collapse action happens on single tap. Here ExpandOn attribute is set to single click property also can use double click and none property.

    Declaration
    public TreeViewBuilder ExpandOn(ExpandOnSettings expandOn)
    Parameters
    Type Name Description
    ExpandOnSettings expandOn
    Returns
    Type Description
    TreeViewBuilder

    Fields(TreeViewFieldsSettings)

    Specifies the data source and mapping fields to render TreeView nodes.

    Declaration
    public TreeViewBuilder Fields(TreeViewFieldsSettings fields)
    Parameters
    Type Name Description
    TreeViewFieldsSettings fields
    Returns
    Type Description
    TreeViewBuilder

    Fields(Action<TreeViewFieldsSettingsBuilder>)

    Declaration
    public TreeViewBuilder Fields(Action<TreeViewFieldsSettingsBuilder> fields)
    Parameters
    Type Name Description
    System.Action<TreeViewFieldsSettingsBuilder> fields
    Returns
    Type Description
    TreeViewBuilder

    FullRowNavigable(Boolean)

    If this property is set to true, then the entire TreeView node will be navigate-able instead of text element.

    Declaration
    public TreeViewBuilder FullRowNavigable(bool fullRowNavigable = true)
    Parameters
    Type Name Description
    System.Boolean fullRowNavigable
    Returns
    Type Description
    TreeViewBuilder

    FullRowSelect(Boolean)

    On enabling this property, the entire row of the TreeView node gets selected by clicking a node. When disabled only the corresponding node's text gets selected. For more information on Fields concept, refer to Fields.

    Declaration
    public TreeViewBuilder FullRowSelect(bool fullRowSelect = true)
    Parameters
    Type Name Description
    System.Boolean fullRowSelect
    Returns
    Type Description
    TreeViewBuilder

    HtmlAttributes(Object)

    Allows additional HTML attributes such as title, name, etc., and accepts n number of attributes in a key-value pair format.

    Declaration
    public TreeViewBuilder HtmlAttributes(object htmlAttributes)
    Parameters
    Type Name Description
    System.Object htmlAttributes
    Returns
    Type Description
    TreeViewBuilder

    KeyPress(String)

    Event callback that is raised when key press is successful. It helps to customize the operations at key press.

    Declaration
    public TreeViewBuilder KeyPress(string keyPress)
    Parameters
    Type Name Description
    System.String keyPress
    Returns
    Type Description
    TreeViewBuilder

    LoadOnDemand(Boolean)

    By default, the load on demand (Lazy load) is set to true. By disabling this property, all the tree nodes are rendered at the beginning itself.

    Declaration
    public TreeViewBuilder LoadOnDemand(bool loadOnDemand = true)
    Parameters
    Type Name Description
    System.Boolean loadOnDemand
    Returns
    Type Description
    TreeViewBuilder

    NodeChecked(String)

    Event callback that is raised when the TreeView node is checked/unchecked successfully.

    Declaration
    public TreeViewBuilder NodeChecked(string nodeChecked)
    Parameters
    Type Name Description
    System.String nodeChecked
    Returns
    Type Description
    TreeViewBuilder

    NodeChecking(String)

    Event callback that is raised before the TreeView node is to be checked/unchecked.

    Declaration
    public TreeViewBuilder NodeChecking(string nodeChecking)
    Parameters
    Type Name Description
    System.String nodeChecking
    Returns
    Type Description
    TreeViewBuilder

    NodeClicked(String)

    Event callback that is raised when the TreeView node is clicked successfully.

    Declaration
    public TreeViewBuilder NodeClicked(string nodeClicked)
    Parameters
    Type Name Description
    System.String nodeClicked
    Returns
    Type Description
    TreeViewBuilder

    NodeCollapsed(String)

    Event callback that is raised when the TreeView node collapses successfully.

    Declaration
    public TreeViewBuilder NodeCollapsed(string nodeCollapsed)
    Parameters
    Type Name Description
    System.String nodeCollapsed
    Returns
    Type Description
    TreeViewBuilder

    NodeCollapsing(String)

    Event callback that is raised before the TreeView node collapses.

    Declaration
    public TreeViewBuilder NodeCollapsing(string nodeCollapsing)
    Parameters
    Type Name Description
    System.String nodeCollapsing
    Returns
    Type Description
    TreeViewBuilder

    NodeDragging(String)

    Event callback that is raised when the TreeView node is dragged (moved) continuously.

    Declaration
    public TreeViewBuilder NodeDragging(string nodeDragging)
    Parameters
    Type Name Description
    System.String nodeDragging
    Returns
    Type Description
    TreeViewBuilder

    NodeDragStart(String)

    Event callback that is raised when the TreeView node drag (move) starts.

    Declaration
    public TreeViewBuilder NodeDragStart(string nodeDragStart)
    Parameters
    Type Name Description
    System.String nodeDragStart
    Returns
    Type Description
    TreeViewBuilder

    NodeDragStop(String)

    Event callback that is raised when the TreeView node drag (move) is stopped.

    Declaration
    public TreeViewBuilder NodeDragStop(string nodeDragStop)
    Parameters
    Type Name Description
    System.String nodeDragStop
    Returns
    Type Description
    TreeViewBuilder

    NodeDropped(String)

    Event callback that is raised when the TreeView node is dropped on target element successfully.

    Declaration
    public TreeViewBuilder NodeDropped(string nodeDropped)
    Parameters
    Type Name Description
    System.String nodeDropped
    Returns
    Type Description
    TreeViewBuilder

    NodeEdited(String)

    Event callback that is raised when the TreeView node is renamed successfully.

    Declaration
    public TreeViewBuilder NodeEdited(string nodeEdited)
    Parameters
    Type Name Description
    System.String nodeEdited
    Returns
    Type Description
    TreeViewBuilder

    NodeEditing(String)

    Event callback that is raised before the TreeView node is renamed.

    Declaration
    public TreeViewBuilder NodeEditing(string nodeEditing)
    Parameters
    Type Name Description
    System.String nodeEditing
    Returns
    Type Description
    TreeViewBuilder

    NodeExpanded(String)

    Event callback that is raised when the TreeView node expands successfully.

    Declaration
    public TreeViewBuilder NodeExpanded(string nodeExpanded)
    Parameters
    Type Name Description
    System.String nodeExpanded
    Returns
    Type Description
    TreeViewBuilder

    NodeExpanding(String)

    Event callback that is raised before the TreeView node is to be expanded.

    Declaration
    public TreeViewBuilder NodeExpanding(string nodeExpanding)
    Parameters
    Type Name Description
    System.String nodeExpanding
    Returns
    Type Description
    TreeViewBuilder

    NodeSelected(String)

    Event callback that is raised when the TreeView node is selected/unselected successfully.

    Declaration
    public TreeViewBuilder NodeSelected(string nodeSelected)
    Parameters
    Type Name Description
    System.String nodeSelected
    Returns
    Type Description
    TreeViewBuilder

    NodeSelecting(String)

    Event callback that is raised before the TreeView node is selected/unselected.

    Declaration
    public TreeViewBuilder NodeSelecting(string nodeSelecting)
    Parameters
    Type Name Description
    System.String nodeSelecting
    Returns
    Type Description
    TreeViewBuilder

    NodeTemplate(String)

    Specifies a template to render customized content for all the nodes. If the nodeTemplate property is set, the template content overrides the displayed node text. The property accepts template string template string or HTML element ID holding the content. For more information on template concept, refer to Template.

    Declaration
    public TreeViewBuilder NodeTemplate(string nodeTemplate)
    Parameters
    Type Name Description
    System.String nodeTemplate
    Returns
    Type Description
    TreeViewBuilder

    Render()

    Declaration
    public HtmlString Render()
    Returns
    Type Description
    System.Web.HtmlString

    SelectedNodes(String[])

    Represents the selected nodes in the TreeView component. We can set the nodes that need to be selected or get the ID of the nodes that are currently selected by using this property. On enabling allowMultiSelection property we can select multiple nodes and on disabling it we can select only a single node. For more information on selectedNodes, refer to selectedNodes.

    Declaration
    public TreeViewBuilder SelectedNodes(string[] selectedNodes)
    Parameters
    Type Name Description
    System.String[] selectedNodes
    Returns
    Type Description
    TreeViewBuilder

    ShowCheckBox(Boolean)

    Indicates that the nodes will display CheckBoxes in the TreeView. The CheckBox will be displayed next to the expand/collapse icon of the node. For more information on CheckBoxes, refer to CheckBox.

    Declaration
    public TreeViewBuilder ShowCheckBox(bool showCheckBox = true)
    Parameters
    Type Name Description
    System.Boolean showCheckBox
    Returns
    Type Description
    TreeViewBuilder

    SortOrder(SortOrder)

    Specifies a value that indicates whether the nodes are sorted in the ascending or descending order, or are not sorted at all. The available types of sort order are, None - The nodes are not sorted. Ascending - The nodes are sorted in the ascending order. Descending - The nodes are sorted in the ascending order.

    Declaration
    public TreeViewBuilder SortOrder(SortOrder sortOrder)
    Parameters
    Type Name Description
    SortOrder sortOrder
    Returns
    Type Description
    TreeViewBuilder
    Back to top Generated by DocFX
    Copyright © 2001 - 2023 Syncfusion Inc. All Rights Reserved