Quantcast
Viewing all articles
Browse latest Browse all 18858

WPF DYNAMIC TREE VIEW....

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:

Image may be NSFW.
Clik here to view.

Actual Output:On my datatable for first two column i havent mention managerid....so that two persons are managers.....so on my actual output two headers should come after clicking that it should display the employee who comes below that.Right now only one is coming...help me urgent.


Thanks SABARINATHAN87


Viewing all articles
Browse latest Browse all 18858

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>