alexa
menu

ASP.NET MVC - EJ2

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

    Show / Hide Table of Contents

    Class TreeView

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

    Constructors

    TreeView()

    Declaration
    public TreeView()

    Properties

    ActionFailure

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

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

    The default value is null

    AllowDragAndDrop

    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 bool AllowDragAndDrop { get; set; }
    Property Value
    Type Description
    System.Boolean

    The default value is false

    AllowEditing

    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 bool AllowEditing { get; set; }
    Property Value
    Type Description
    System.Boolean

    The default value is false

    AllowMultiSelection

    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 bool AllowMultiSelection { get; set; }
    Property Value
    Type Description
    System.Boolean

    The default value is false

    AllowTextWrap

    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 bool AllowTextWrap { get; set; }
    Property Value
    Type Description
    System.Boolean

    The default value is false

    Animation

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

    Declaration
    public TreeViewNodeAnimationSettings Animation { get; set; }
    Property Value
    Type Description
    TreeViewNodeAnimationSettings

    The default value is null

    AutoCheck

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

    Declaration
    public bool AutoCheck { get; set; }
    Property Value
    Type Description
    System.Boolean

    The default value is true

    CheckDisabledChildren

    Determines whether the disabled children will be checked or not if their parent is checked.

    Declaration
    public bool CheckDisabledChildren { get; set; }
    Property Value
    Type Description
    System.Boolean

    The default value is true

    CheckedNodes

    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 string[] CheckedNodes { get; set; }
    Property Value
    Type Description
    System.String[]

    The default value is null

    CheckOnClick

    Specifies whether the item should be checked or unchecked when the node is clicked.

    Declaration
    public bool CheckOnClick { get; set; }
    Property Value
    Type Description
    System.Boolean

    The default value is false

    Created

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

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

    The default value is null

    CssClass

    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 string CssClass { get; set; }
    Property Value
    Type Description
    System.String

    The default value is ""

    DataBound

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

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

    The default value is null

    DataSourceChanged

    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 string DataSourceChanged { get; set; }
    Property Value
    Type Description
    System.String

    The default value is null

    Destroyed

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

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

    The default value is null

    Disabled

    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 bool Disabled { get; set; }
    Property Value
    Type Description
    System.Boolean

    The default value is false

    DisableHtmlEncode

    Declaration
    public bool DisableHtmlEncode { get; set; }
    Property Value
    Type
    System.Boolean

    DragArea

    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 string DragArea { get; set; }
    Property Value
    Type Description
    System.String

    The default value is null

    DrawNode

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

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

    The default value is null

    EnableHtmlSanitizer

    Specifies whether to display or remove the untrusted HTML values in the TreeView component. If 'enableHtmlSanitizer' set to true, the component will sanitize any suspected untrusted strings and scripts before rendering them.

    Note: To correctly remove untrusted HTML values, disableHtmlEncode must also be set to true. When enableHtmlSanitizer is set to false, disableHtmlEncode must also be set to false.

    Declaration
    public bool EnableHtmlSanitizer { get; set; }
    Property Value
    Type Description
    System.Boolean

    The default value is true

    EnablePersistence

    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 bool EnablePersistence { get; set; }
    Property Value
    Type Description
    System.Boolean

    The default value is false

    EnableRtl

    Enable or disable rendering component in right to left direction.

    Declaration
    public bool EnableRtl { get; set; }
    Property Value
    Type Description
    System.Boolean

    The default value is false

    ExpandedNodes

    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 string[] ExpandedNodes { get; set; }
    Property Value
    Type Description
    System.String[]

    The default value is null

    ExpandOn

    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 ExpandOnSettings ExpandOn { get; set; }
    Property Value
    Type Description
    ExpandOnSettings

    The default value is ExpandOnSettings.Auto

    Fields

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

    Declaration
    public TreeViewFieldsSettings Fields { get; set; }
    Property Value
    Type Description
    TreeViewFieldsSettings

    The default value is null

    FullRowNavigable

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

    Declaration
    public bool FullRowNavigable { get; set; }
    Property Value
    Type Description
    System.Boolean

    The default value is false

    FullRowSelect

    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 bool FullRowSelect { get; set; }
    Property Value
    Type Description
    System.Boolean

    The default value is true

    HtmlAttributes

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

    Declaration
    public object HtmlAttributes { get; set; }
    Property Value
    Type
    System.Object

    KeyPress

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

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

    The default value is null

    LoadOnDemand

    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 bool LoadOnDemand { get; set; }
    Property Value
    Type Description
    System.Boolean

    The default value is true

    NodeChecked

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

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

    The default value is null

    NodeChecking

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

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

    The default value is null

    NodeClicked

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

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

    The default value is null

    NodeCollapsed

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

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

    The default value is null

    NodeCollapsing

    Event callback that is raised before the TreeView node collapses.

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

    The default value is null

    NodeDragging

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

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

    The default value is null

    NodeDragStart

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

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

    The default value is null

    NodeDragStop

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

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

    The default value is null

    NodeDropped

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

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

    The default value is null

    NodeEdited

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

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

    The default value is null

    NodeEditing

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

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

    The default value is null

    NodeExpanded

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

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

    The default value is null

    NodeExpanding

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

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

    The default value is null

    NodeSelected

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

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

    The default value is null

    NodeSelecting

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

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

    The default value is null

    NodeTemplate

    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 string NodeTemplate { get; set; }
    Property Value
    Type Description
    System.String

    The default value is null

    SelectedNodes

    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 string[] SelectedNodes { get; set; }
    Property Value
    Type Description
    System.String[]

    The default value is null

    ShowCheckBox

    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 bool ShowCheckBox { get; set; }
    Property Value
    Type Description
    System.Boolean

    The default value is false

    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 SortOrder SortOrder { get; set; }
    Property Value
    Type Description
    SortOrder

    The default value is SortOrder.None

    Back to top Generated by DocFX
    Copyright © 2001 - 2026 Syncfusion Inc. All Rights Reserved