Hi Shwetha ,
 
try this work great,done using C# windaw application,
 
create sample like this, debug line by line then you will understand.
  1. using System.Collections.Generic;  
  2. using System.Data;  
  3. using System.Linq;  
  4. using System.Windows.Forms;  
  5. namespace TreeviewBindingWithID  
  6. {  
  7. public partial class Form1 : Form  
  8. {  
  9. public Form1()  
  10. {  
  11. InitializeComponent();  
  12. FillTreeView();  
  13. }  
  14. private class ItemInfo  
  15. {  
  16. public int ID;  
  17. public int ParentID;  
  18. public string Name;  
  19. }  
  20. private void FillTreeView()  
  21. {  
  22. var items = new List()  
  23. {  
  24. new ItemInfo(){ID = 1, ParentID = 4, Name = "A"},  
  25. new ItemInfo(){ID = 2, ParentID = 1, Name = "A1"},  
  26. new ItemInfo(){ID = 3, ParentID = 0, Name = "B"},  
  27. new ItemInfo(){ID = 4, ParentID = 0, Name = "C"},  
  28. new ItemInfo(){ID = 5, ParentID = 1, Name = "A2"},  
  29. new ItemInfo(){ID = 6, ParentID = 3, Name = "B1"},  
  30. };  
  31. FillNode(items, null);  
  32. }  
  33. private void FillNode(List items, TreeNode node)  
  34. {  
  35. var parentID = node != null ? (int)node.Tag : 0;  
  36. var nodesCollection = node != null ? node.Nodes : treeView1.Nodes;  
  37. foreach (var item in items.Where(i => i.ParentID == parentID))  
  38. {  
  39. var newNode = nodesCollection.Add(item.Name, item.Name);  
  40. newNode.Tag = item.ID;  
  41. FillNode(items, newNode);  
  42. }  
  43. }  
  44. }  
  45. }