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

Show CheckedNodes in RadTreeview

4 Answers 211 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Mahesh
Top achievements
Rank 1
Mahesh asked on 21 Jan 2012, 03:15 PM
Hi,
      I am using one RadTreeview control with CheckBoxes. I want to show the CheckedNodes in another RadTreeview control.

Can someone please help me out ASAP?

Thanks,
Mahesh

4 Answers, 1 is accepted

Sort by
0
Mahesh
Top achievements
Rank 1
answered on 22 Jan 2012, 02:19 PM
Any update plz?
0
Jayesh Goyani
Top achievements
Rank 2
answered on 22 Jan 2012, 04:00 PM
Hello Mahesh,

TreeView / CheckBox Support

Thanks,
Jayesh Goyani
0
Mahesh
Top achievements
Rank 1
answered on 22 Jan 2012, 06:29 PM
Hi Jayesh,
                  Thanks for the replay, I have seen this example already and developed my app based on this demo only. 

My problem is after getting "treeView1.CheckedNodes" into IList<RadTreeNode> object as below

IList<RadTreeNode> nodeCollection = treeView1.CheckedNodes; 

Then i am trying to add this collection object into my second treeview as a preview  when click on button(preview)

foreach (RadTreeNode node in nodeCollection)
{
    if(node.ParentNode.Text == "SomeText")   // All CheckedNodes have been updated in my 2nd treeview(preview) when i add root node of the first treeview so that here i break the loop after adding root node.

      {
treeView2.Nodes.add(node);
break; } }

treeView2.ExpendAllNodes(); 


Actual problem:
    My second treeview(preview) is updating when i was checked some nodes from first treeview and click on preview button...Its OK. But if I make some changes in the checkbox selection in the first treeview then click preview button it was not showing actual selection..its only showing 1st time checkedNodes only.


Hope you understand my problem. Please let me know if any questions.

Thanks,
Mahesh


0
Princy
Top achievements
Rank 2
answered on 10 Oct 2012, 10:43 AM
Hi Mahesh,

Here is the sample code that I tried based on your scenario which works as expected.

C#:
protected void Preview_Click(object sender, EventArgs e)
{
 RadTreeView2.Nodes.Clear();
 IList<RadTreeNode> nodeCollection = RadTreeView1.CheckedNodes;
 foreach (RadTreeNode node in nodeCollection)
 {
   RadTreeNode newNode = new RadTreeNode(node.Text);
   RadTreeView2.Nodes.Add(newNode);
 }
}

Thanks,
Princy.
Tags
TreeView
Asked by
Mahesh
Top achievements
Rank 1
Answers by
Mahesh
Top achievements
Rank 1
Jayesh Goyani
Top achievements
Rank 2
Princy
Top achievements
Rank 2
Share this question
or