Server Side Node Expand is not working for NodeTemplate

7 posts, 1 answers
  1. hbanerjee
    hbanerjee avatar
    8 posts
    Member since:
    Aug 2007

    Posted 19 Sep 2008 Link to this post

    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
  2. Atanas Korchev
    Admin
    Atanas Korchev avatar
    8462 posts

    Posted 19 Sep 2008 Link to this post

    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.
  3. hbanerjee
    hbanerjee avatar
    8 posts
    Member since:
    Aug 2007

    Posted 19 Sep 2008 Link to this post

    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>

  4. Atanas Korchev
    Admin
    Atanas Korchev avatar
    8462 posts

    Posted 19 Sep 2008 Link to this post

    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.
  5. hbanerjee
    hbanerjee avatar
    8 posts
    Member since:
    Aug 2007

    Posted 19 Sep 2008 Link to this post

    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
  6. Answer
    Atanas Korchev
    Admin
    Atanas Korchev avatar
    8462 posts

    Posted 19 Sep 2008 Link to this post

    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.
  7. hbanerjee
    hbanerjee avatar
    8 posts
    Member since:
    Aug 2007

    Posted 19 Sep 2008 Link to this post

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

    HB

Back to Top