ASP.NET TreeView - Example of Server Events

Name Description
methodOnNodeSelect Invoked after node was selected.

OnNodeSelect ( id )

  • id is an identifier of newly selected node.


  • Example ...
    methodOnNodeEdit Invoked after node was edited.

    OnNodeEdit ( id , text , prevText )

  • id is a node identifier
  • text is a new text of a node
  • prevText is an old text, as a name suggests


  • Example ...
    methodOnNodeDrop Invoked after node src was dropped to dst
    copy is set to true if src was copied to dst (using CTRL + D-n-d)

    OnNodeDrop ( src , dst , copy )

  • src source node
  • dst destination node
  • copy true/false if copy or not


  • Example ...
    methodOnAddNode Invoked after node was added

    OnAddNode ( parentId , childId , textOrHTML , expanded , image , subTreeURL )

  • parentId: ID of parent node
  • childId: Node ID
  • textOrHTML: Text or HTML to display inside the node
  • expanded: When True, node is open on load
  • image: Icon image
  • subTreeURL: URL to page with tree for loading dynamically


  • Example ...
    methodOnRemoveNode Invoked after node was removed

    OnRemoveNode ( id )

  • id: id is an identifier of an already removed node


  • Example ...
    methodOnNodeExpand Invoked when a node is expanded

    OnNodeExpand ( id , dynamic )

  • id: id is an identifier the expanded node
  • dynamic: is set to true if the node is parent for a dynamic subtree


  • Example ...
    methodOnNodeCollapse Invoked when a node is collapsed

    OnNodeCollapse ( id )

  • id: id is an identifier the collapsed node


  • Example ...
    methodOnBeforeNodeEdit Invoked just before user starts to edit a node's text. Return false to prevent editing

    OnBeforeNodeEdit ( id )

  • id: is the id of the edited node


  • Example ...
    methodOnBeforeAddNode Invoked just before Treeview starts to add a node

    OnBeforeAddNode ( parentId , childId , textOrHTML , expanded , image , subTreeURL )

  • parentId: ID of parent node
  • childId: Node ID
  • textOrHTML: Text or HTML to display inside the node
  • expanded: When True, node is open on load
  • image: Icon image
  • subTreeURL: URL to page with tree for loading dynamically


  • Example ...
    methodOnBeforeRemoveNode Invoked just before Treeview starts to remove a node

    OnBeforeRemoveNode ( id )

  • id: is the identify of the node to be removed


  • Example ...
    methodOnBeforeNodeDrop Invoked before completing a drag-and-drop operation.
    Not invoked when drag-and-drop is not successful for some other reasons.
    If CTRL + D-n-d is used for copying src to dst, copy will be true

    OnBeforeNodeDrop ( src , dst , copy )

  • src source node
  • dst destination node
  • copy true/false if copy or not


  • Example ...
    methodOnMoveNodeUp Invoked when a node is moved up

    OnMoveNodeUp ( node_up_id , node_down_id )

  • node_up_id: is the identifier of the moved node
  • node_down_id: is the identifier of the replaced node


  • Example ...
    methodOnMoveNodeDown Invoked when a node is moved down

    OnMoveNodeDown ( node_down_id , node_up_id )

  • node_down_id: is the identifier of the moved node
  • node_up_id: is the identifier of the replaced node


  • Example ...
    obout.com
    obout.com Home
    News
    TreeView Home
    TreeView Home
    Download
    Site Map
    Examples 
    Styles
    Classic
    Classic
    Dynamic Loading
    No Icons
    Black
    Black No Icons
    Background image
    Premiere New
    black
    blue
    green
    red
    violet
    yellow
    Explorer
    Gray
    Help
    HelpPlus
    MSDN
    TMenu
    TMenu (small icons)
    Vista New
    Web
    White
    XPBlue
    Win2003
    Right To Left
    Features
    Drag and drop - 18
    Drag-n-Drop
    Custom
    Multi-node
    Dragging with children
    Drop in textboxes
    External D'n'D
    Move nodes 1
    Renumber nodes
    Auto Scrolling
    Copy / Move nodes
    D'n'd and Dynamic Loading
    Drop in listboxes
    Drop in listboxes 2
    Restrict Levels
    D'n'D with various options
    Disable dropping in two trees
    Not-allowed Icon New
    Sort after D'n'D New
    Dynamic loading - 6
    Web style
    MSDN style
    Deep tree
    Reload subtrees
    Loading trees partially
    Virtual Scrolling New
    Add/remove nodes - 4
    Add/remove on client-side
    Alphabetical order
    Add to dynamic subtrees
    Remove all children
    Edit nodes - 4
    Edit nodes
    Nodes with Checkboxes
    Sort after Edit New
    Select nodes - 3
    Find selected node
    Select multiple nodes
    Highlight parent
    Layout - 2
    Width, height and scrollbars
    Root node
    TreeView state - 3
    Dynamic
    Keep expanded
    Keep collapsed
    File system - 3
    Show file system
    File system loading
    File system manager
    Additional data for each node - 3
    Details
    On client side
    Image viewer
    Expand/collapse nodes - 2
    By level
    Single folder
    Multiple trees - 4
    Two Trees
    Two Trees custom
    Two Trees enhancement
    Move Nodes BTWN Trees New
    Different Styles New
    Validation - 2
    D-n-d on server
    Edit on server
    Integration - 14
    With a context menu
    Attach Easy Menu
    Attach menu on-demand
    Attach to dynamic nodes
    Attach menu to icons
    Change icons
    With Flyout
    With Splitter
    MS AJAX
    With checkboxes
    Dynamic checkboxes
    With a Combobox
    With modal dialog
    Outlook Slide Menu
    With Tab Strip
    Build from SiteMap
    Customization - 7
    Icons for treeview
    Aligned columns
    CSS Tutorial
    Hover node effect
    Multi-Level Slide Menu
    Select on Collapse
    From Dennis
    From/To XML file
    Keyboard navigation
    Search nodes
    Client-side events
    Knowledge Base - 1
    Knowledge Base
    Documentation
    Method Add
    Server-Side
    Client-Side
    Client-Side Events
    XML
    Methods
    XML Tutorial
    Client-Side Tutorial
    Tutorial 1
    Tutorial 2
    Tutorial 3
    Tutorial 4
    Events
    Tutorial
    Event handlers
    Tutorials
    Using the correct path
    Improving performance
    In a user control
    AutoPostBack with various options
    Open in Search pane
    Move nodes by clicking a button
    Postback on node select
    Switch icons