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

Create a dinamically treeview

1 Answer 61 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Bruno
Top achievements
Rank 1
Bruno asked on 05 Mar 2012, 12:45 PM
I wanna create the treeview data, and looks like this.

-Past
    -Example1
             - child1
             - child2
    -Example2
            - child3
            - child4

Until now i dont found any stuff about that, and i facing some problems to do that.
Does anyone know how can i do that?

1 Answer, 1 is accepted

Sort by
0
Accepted
Princy
Top achievements
Rank 2
answered on 06 Mar 2012, 04:59 AM
Hello,

Try the following code.
C#:
protected void Page_Load(object sender, EventArgs e)
 {
  RadTreeView RadTreeView1 = new RadTreeView();
  RadTreeNode Past = new RadTreeNode();
  Past.Text = "Past";
  RadTreeNode Example1 = new RadTreeNode();
  Example1.Text = "Example1";
  RadTreeNode child1 = new RadTreeNode();
  child1.Text = "child1";
  RadTreeNode child2 = new RadTreeNode();
  child2.Text = "child2";
  RadTreeNode Example2 = new RadTreeNode();
  Example2.Text = "Example2";
  RadTreeNode child3 = new RadTreeNode();
  child3.Text = "child3";
  RadTreeNode child4 = new RadTreeNode();
  child4.Text = "child4";
  RadTreeView1.Nodes.Add(Past);
  Past.Nodes.Add(Example1);
  Past.Nodes.Add(Example2);
  Example1.Nodes.Add(child1);
  Example1.Nodes.Add(child2);
  Example2.Nodes.Add(child3);
  Example2.Nodes.Add(child4);
  form1.Controls.Add(RadTreeView1);
 }

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