Advertisement
Guest User

TreeView in asp.net : How to insert two column in child nodes in treeview

a guest
Apr 6th, 2012
173
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.16 KB | None | 0 0
  1. + Parent Node
  2. - Child Node [Text] [Button]
  3. - Child Node [Text1] [Button1]
  4. - Child Node [Text2] [Button2]
  5.  
  6. TreeView1.Nodes.Clear();
  7.  
  8. if (dtTree != null)
  9. {
  10. // Create DataRelation.................
  11. DataRelation rel = new DataRelation("ClientCategory", dtTree.Tables[0].Columns["TPAClientGroupId"],
  12. dtTree.Tables[1].Columns["TPAClientGroupId"], false);
  13. rel.Nested = true;
  14.  
  15. dtTree.Relations.Add(rel);
  16. // Set the Attribute here .........................
  17. foreach (DataColumn dc in dtTree.Tables[0].Columns)
  18. {
  19. dc.ColumnMapping = MappingType.Attribute;
  20. }
  21. foreach (DataColumn dc in dtTree.Tables[1].Columns)
  22. {
  23. dc.ColumnMapping = MappingType.Attribute;
  24. }
  25.  
  26. // xml decleartion ......................................
  27. XmlDataSource xmlD = new System.Web.UI.WebControls.XmlDataSource();
  28.  
  29.  
  30. xmlD.ID = "XmlDataSource1";
  31. // Call GetXml and assign to xml data source.
  32. XmlDataSource1.Data = dtTree.GetXml();
  33.  
  34.  
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement