ASPTreeView Control - Client-Side Events

You can find event functions in tree2/script/ob_events_xxxx.js
You can either modify default function, or add one using script tag directly to page, placing it just after </html> tag.

For example - event handler function for OnNodeSelect:
function ob_OnNodeSelect(id)

All client-side events are enabled by default.

Available events:

Name Description
OnNodeSelect ob_OnNodeSelect(id)

Invoked after node was selected.
id is an identifier of newly selected node.
OnNodeEdit ob_OnNodeEdit(id, text, prevText)

Invoked after node was edited
id is a node identifier
text is a new text of a node
prevText is an old text, as a name suggests
OnNodeDrop ob_OnNodeDrop(src, dst, copy)

Invoked after node src was dropped to dst
copy is set to true if src was copied to dst (using CTRL + D-n-d)
OnNodeDropOutside ob_OnNodeDropOutside(src)

Invoked when the dragged node is droped outside the TreeView.
src represents the dragged node.
OnAddNode ob_OnAddNode(parentId, childId, textOrHTML, expanded, image, subTreeURL)

Invoked after node was added by ob_t2_Add client-side function.
For more information on ob_t2_Add function look here
OnRemoveNode ob_OnRemoveNode(id)

Invoked after node was removed by ob_t2_Remove client-side function
id is an identifier of an already removed node
and thus is only useful to send it to server-side
(or clean-up data linked with it on the client-side)
OnNodeExpand ob_OnNodeExpand(id, dynamic)

Invoked when a node is expanded.
id is the identifier of the expanded node
dynamic is set to true if the node is parent for a dynamic subtree
OnNodeCollapse ob_OnNodeCollapse(id)

Invoked when a node is collapsed.
id is the identifier of the collapsed node
OnMoveNodeUp ob_OnMoveNodeUp(node_up_id, node_down_id)

Invoked when a node is moved up using the ob_t2_UpDown function.
node_up_id is the identifier of the moved node
node_down_id is the identifier of the replaced node
OnMoveNodeDown ob_OnMoveNodeDown(node_down_id, node_up_id)

Invoked when a node is moved down using the ob_t2_UpDown function.
node_down_id is the identifier of the moved node
node_up_id is the identifier of the replaced node

Events - validating events(must return true or false)

Name Description
OnBeforeNodeSelect ob_OnBeforeNodeSelect(id)

Invoked just before a node is selected. Return false to prevent node selection.
OnBeforeNodeEdit ob_OnBeforeNodeEdit(id)

Invoked just before user starts to edit a node's text. Return false to prevent editing.
id is the id of the edited node
OnBeforeAddNode ob_OnBeforeAddNode(parentId, childId, textOrHTML, expanded, image, subTreeURL)

Invoked before ob_t2_Add adds a node.
For more information see OnAddNode description above.
OnBeforeRemoveNode ob_OnBeforeRemoveNode(id)

Invoked before ob_t2_Remove removes a node.
For more information see OnRemoveNode description above.
OnBeforeNodeDrop ob_OnBeforeNodeDrop(src, dst, copy)

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
OnBeforeNodeDrag ob_OnBeforeNodeDrag(id)

Invoked before starting to drag the node.
OnBeforeNodeDropOutside ob_OnBeforeNodeDropOutside(dst)

Invoked before completing a drag-and-drop operation outside the tree.
OnBeforeNodeExpand ob_OnBeforeNodeExpand(id, dynamic)

Invoked before expanding a node. If the node is the parent
of a dynamic subtree, dynamic will be set to true
OnBeforeNodeCollapse ob_OnBeforeNodeCollapse(id)

Invoked before collapsing a node. Home
TreeView Home
TreeView Home
Site Map
Dynamic Loading
No Icons
Black No Icons
Background image
Premiere New
TMenu (small icons)
Vista New
Right To Left
Drag and drop - 18
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
Keep expanded
Keep collapsed
File system - 3
Show file system
File system loading
File system manager
Additional data for each node - 3
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
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
Method Add
Client-Side Events
XML Tutorial
Client-Side Tutorial
Tutorial 1
Tutorial 2
Tutorial 3
Tutorial 4
Event handlers
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