This is a migrated thread and some comments may be shown as answers.

Server Side Node Expand is not working for NodeTemplate

6 Answers 152 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
hbanerjee
Top achievements
Rank 1
hbanerjee asked on 19 Sep 2008, 06:50 AM
When I have a RadTree with a <NodeTemplate>. ServerSide NodeExpand or NodeCollapse events are not firing but the nodes are expanding and collapsing just fine. Is that the intended behaviour? How do I get these events to fire?

Thanks
Himadri

6 Answers, 1 is accepted

Sort by
0
Atanas Korchev
Telerik team
answered on 19 Sep 2008, 06:56 AM
Hello hbanerjee,

I couldn't reproduce this problem by modifying our online example. What could be different in your case? Did you set the ExpandMode property of your nodes to ServerSide? This is required in order for the NodeExpand/NodeCollapse events to fire.

Regards,
Albert
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
hbanerjee
Top achievements
Rank 1
answered on 19 Sep 2008, 07:31 AM
Albert
         There is no ExpandMode for the RadTreeView Control. It's a property of a node but I have the whole tree declared as a NodeTemplate. Below is the code snippet.
NodeDataBound is firing fine but NodeExpand and NodeCollapse Events are not firing.

<telerik:RadTreeView ID="RadTreeView1" Width="100%" runat="server" ShowLineImages="False" OnNodeDataBound="RadTreeView1_DataBound" >

<NodeTemplate>
    <div> ......MY HTML STUFF
    </div>
</NodeTemplate>
<CollapseAnimation Type="OutQuint" Duration="100"></CollapseAnimation>
<ExpandAnimation Duration="100"></ExpandAnimation>
</telerik:RadTreeView>

0
Atanas Korchev
Telerik team
answered on 19 Sep 2008, 07:37 AM
Hi hbanerjee,

As I said in my previous reply you need to set the ExpandMode property of your nodes to ServerSide in order to fire the NodeExpand and NodeCollapse events. You can do this by subscribing to the NodeDataBound event.

Regards,
Albert
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
hbanerjee
Top achievements
Rank 1
answered on 19 Sep 2008, 08:08 AM
Thank you. It worked but I did notice something different. Now as soon as I do that every node in that tree has the plus sign besides it whether it has a child or not. Before the ones with children had the plus sign. Am I supposed to do something in order for that to go away in the code?

Thanks
Himadri
0
Accepted
Atanas Korchev
Telerik team
answered on 19 Sep 2008, 08:25 AM
Hello hbanerjee,

You can subscribe to the DataBound event of the treeview (not to be mistaken with NodeDataBound) and traverse all nodes (GetAllNodes()). Then set the ExpandMode property to ServerSide only of nodes which have children (node.Nodes.Count > 0).

Regards,
Albert
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
hbanerjee
Top achievements
Rank 1
answered on 19 Sep 2008, 08:36 AM

Thank you very much for your support. It works :)

HB

Tags
TreeView
Asked by
hbanerjee
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
hbanerjee
Top achievements
Rank 1
Share this question
or