Hi,
I have a method it will return a TreeViewItem
public TreeViewItem loadtree()
{
DataTable table1 = new DataTable();
table1.Columns.Add("EmpId");
table1.Columns.Add("Manager");
table1.Columns.Add("Managerid");
table1.Rows.Add(1,"sam", "");
table1.Rows.Add(2,"mark", "");
table1.Rows.Add(3,"sabari",1 );
table1.Rows.Add(4,"uday", 2);
table1.Rows.Add(5,"deepan", 2);
table1.Rows.Add(6,"suresh", 1);
table1.Rows.Add(7,"srinath", 1);
DataSet ds = new DataSet();
ds.Tables.Add(table1);
TreeViewItem newChild = new TreeViewItem();
int count = ds.Tables[0].Rows.Count;
for (int i = 0; i < count; i++)
{
newChild.Header = ds.Tables[0].Rows[i][1];
newChild.Items.Add(ds.Tables[0].Rows[i][1]);
}
return newChild;
}
OutPut looks Like:
Actual Output:On my dataset first two column i havent mention managerid....so that two persons are managers.....so on my actual output two treeviewitem should created... after clicking that it should display the employee who comes under that managerid.Right now only one treeviewitem is coming...help me urgent.
Thanks SABARINATHAN87