There are several reasons for the NodeClick event not to be fired.
- The RadTreeView instance is not marked with AutoPostBack="True" - the AutoPostBack property should be enabled so that the treeview control fires a postback upon clicking a node. Since the NodeClick event is a server-side event, the treeview needs to fire a postback so that the NodeClick event gets executed. If you need to fire the NodeClick event only for certain nodes, you can mark only these nodes with PostBack="True".
- The TreeNodes are marked with NavigateUrl - if the NavigateUrl property is set, clicking a node will cause another page to be opened either in a new or the same window. Hence, the NodeClick event cannot be fired as there has been a page redirection.
- The TreeNodes are loaded on demand via a ServerSideCallback - When you add TreeNodes on the client-side (via ExpandMode.ServerSideCallBack), you should take into account that these nodes are not persisted at the server-side. Therefore, these nodes cannot take part in any server-side events. In other words, the NodeClick event will not be fired with these nodes.
Also, you cannot access the nodes on the server-side and change their properties. The nodes are accessible only on the client-side and can take part only in client-side events.
If you need to persist the expanded state of the TreeNodes after a postback, you can use the approach described in the following article:
Storing the expanded state of TreeNodes added via callback
If you need to access the nodes on the server-side, then you should definitely use ExpandMode.ServerSide. Furthermore, you can wrap the treeview with an AJAX Panel (Telerik RadAjaxPanel) that will transform each postback into a callback. Thus, you will keep the needed client-side behavior.
 |
Note: RadTreeView for ASP.NET AJAX, formerly known as "Prometheus", does not have this limitation. Nodes added via ServerSideCallBack persist their state on the server and fire their server-side events. Please check out the online example demonstrating this: Client-Side Load-On-Demand. |
See Also