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

[Solved] Treeview +/- does not change when programatically expanding the node

2 Answers 113 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Jeanne Kornkven
Top achievements
Rank 1
Jeanne Kornkven asked on 09 Mar 2010, 07:58 PM
When one clicks on the +/- button of the node, the node expands and the +/- changes to -.
When I programmatically expand the node, the node expands but the +/- remains +.

How do I address the +/- button in code to get it to behave?

2 Answers, 1 is accepted

Sort by
0
Accepted
Veronica
Telerik team
answered on 10 Mar 2010, 05:13 PM
Hi Jeanne Kornkven,

I've made a test solution to reproduce the problem. 

Using the Load On Demand functionality 5 new nodes are added each time some of the nodes is expanded. This is done in RadTreView_NodeClick event. To be able to change the icon from "+" to "-" you have to change the ExpandMode to ClientSide like in the example below:

protected void RadTreeView1_NodeClick(object sender, RadTreeNodeEventArgs e)
   {
       RadTreeNode node;
       for (int i = 0; i < 5; i++)
       {
           node = new RadTreeNode("New node " + i.ToString(), "New value");
           node.ExpandMode = TreeNodeExpandMode.ServerSideCallBack;
           e.Node.Nodes.Add(node);
       }
       e.Node.Expanded = true;
       e.Node.ExpandMode = TreeNodeExpandMode.ClientSide;
   }

You can find the full code in the attached .zip file.

Please let me know if this was helpful.

Sincerely yours,
Veronica Milcheva
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Jeanne Kornkven
Top achievements
Rank 1
answered on 12 Mar 2010, 12:01 AM
Veronica,
     Thank you , this did the trick!
Thanks ever so much!
Tags
TreeView
Asked by
Jeanne Kornkven
Top achievements
Rank 1
Answers by
Veronica
Telerik team
Jeanne Kornkven
Top achievements
Rank 1
Share this question
or