Hi all,
I have a radTreeView that generates itself on the page load event. Then, when the NodeExpand event is triggered, the node's child are added dynamically to the parent node. From there, everything works well.
Also, just after the page load event, a javascript method is called to add a click event on each icon of the tree. Here how I do this (I picked up the code from another thread in this forum) :
When a user expand a node and all the sub nodes are created with the property oChildLeaf.ExpandMode = TreeNodeExpandMode.ServerSide, everything works well because the javascript method catch the new created nodes. The click event is then added to the icon of the nodes.
But when I set the oChildLeaf.ExpandMode = TreeNodeExpandMode.ServerSideCallBack to the created nodes, the javascript won't catch the new nodes because only a partial postback is sent to the server.
My problem is that I need to set the nodes of my tree to ServerSideCallBack for optimizing performance but the javascript click event won't follow. I tried using the ScriptManager.RegisterStartupScript method to call my javascript on the NodeExpand server-side event but it doesn't seem to work.
Can anyone help me on this?
I have a radTreeView that generates itself on the page load event. Then, when the NodeExpand event is triggered, the node's child are added dynamically to the parent node. From there, everything works well.
Also, just after the page load event, a javascript method is called to add a click event on each icon of the tree. Here how I do this (I picked up the code from another thread in this forum) :
| <script type="text/javascript"> |
| //This function must not be between tags with runat="server" |
| //It adds the click event to every icon in the tree |
| function pageLoad() { |
| var tree = $find("<%=oTreeUsers.ClientID %>"); |
| var i; |
| for (i = 0; i < tree.get_allNodes().length; i++) { |
| var value = tree.get_allNodes()[i].get_value(); |
| var imageElement = tree.get_allNodes()[i].get_imageElement(); |
| var textElement = tree.get_allNodes()[i].get_textElement(); |
| imageElement.id = tree.get_allNodes()[i].get_value(); |
| textElement.id = tree.get_allNodes()[i].get_value(); |
| if (imageElement.addEventListener) { |
| //FireFox |
| imageElement.onclick = function(e) { clickHandler(this, e); }; |
| imageElement.oncontextmenu = function(e) { clickHandler(this, e); }; |
| textElement.oncontextmenu = function(e) { clickHandler(this, e); }; |
| } |
| else { |
| //IE |
| imageElement.onclick = function() { clickHandler(this, window.event); }; |
| imageElement.oncontextmenu = function() { clickHandler(this, window.event); return false; }; |
| textElement.oncontextmenu = function() { clickHandler(this, window.event); return false; }; |
| } |
| } |
| function clickHandler(imageElement, e) { |
| ShowRadMenu(imageElement.id, e); |
| } |
| } |
| </script> |
When a user expand a node and all the sub nodes are created with the property oChildLeaf.ExpandMode = TreeNodeExpandMode.ServerSide, everything works well because the javascript method catch the new created nodes. The click event is then added to the icon of the nodes.
But when I set the oChildLeaf.ExpandMode = TreeNodeExpandMode.ServerSideCallBack to the created nodes, the javascript won't catch the new nodes because only a partial postback is sent to the server.
My problem is that I need to set the nodes of my tree to ServerSideCallBack for optimizing performance but the javascript click event won't follow. I tried using the ScriptManager.RegisterStartupScript method to call my javascript on the NodeExpand server-side event but it doesn't seem to work.
Can anyone help me on this?