HierarchyData LoadFromDataTable Method Chart4.NET - Organization Charting Component (C#/VB.NET/ASP.NET) - Documentation
Onlinewww.Chart4.NET (Documentation) | OnlineSamples Download | Release Notes

Loads data from the given DataTable object. See example below for the desired DataTable format.

Namespace: UnifoChart.Hierarchy
Assembly: UnifoChart.Hierarchy (in UnifoChart.Hierarchy.dll) Version: 3.2.0.0 (3.2)
Syntax

public string LoadFromDataTable(
	ref DataTable DTable
)
public String LoadFromDataTable(
	/** @ref */DataTable DTable
)

Parameters

DTable
Type: OnlineSystem.Data DataTable 
The DataTable object that contains data

Return Value

Returns blank if succeeded, error message otherwise.
Examples


Code Snippet
  1. //Load DATA (datatable)        
  2. DataSet ds = new DataSet( );
  3. DataTable dt = ds.Tables.Add( );
  4.  
  5. //Refer the following link for column information:
  6. //http://unifosys.com/hierarchy-chart/Create_Organization_Chart_From_Database_Sample.html
  7. //column names are not important; but order of columns is.
  8. dt.Columns.Add("id");
  9. dt.Columns.Add("pid");
  10. dt.Columns.Add("txt");
  11. dt.Columns.Add("value");
  12. dt.Columns.Add("tooltip");
  13. dt.Columns.Add("imagefile");
  14. dt.Columns.Add("url");
  15. dt.Columns.Add("category");
  16.  
  17. dt.Rows.Add(new string[] { "1"/*id*/, "0"/*parentid*/, "Joyce Haney\nMarketing"/*text+desc*/, "name23"/*name*/, "Joyce H"/*tooltip*/, "joyce.png"/*photo*/, ""/*url-web only*/, "Director"/*tag*/ });
  18. dt.Rows.Add(new string[] { "2", "6", "Fahad M.\nAdministration", "", "", "fahad.png", "", "Manager" });
  19. dt.Rows.Add( new string[] { "3", "1", "Palm Blazer\nCustomer Care", "", "tooltip1", "palm.png", "", "Executive" } );
  20. dt.Rows.Add( new string[] { "4", "", "Steve Bullock\nDevelopment", "", "", "steve.png", "", "Director" } );
  21. dt.Rows.Add( new string[] { "5", "2", "Kendra Spring\nAssistant", "", "", "kendra.png", "", "Executive" } );
  22. dt.Rows.Add( new string[] { "6", "", "Shelly Tylor\nSales\nAdministration", "", "NULL", "shelly.png", "", "Director" } );
  23. dt.Rows.Add( new string[] { "7", "4", "Mike Rupert\n", "", "", "mike1.png", "", "Manager" } );
  24. dt.Rows.Add( new string[] { "8", "4", "Meg Steve\n", "", "", "meg.png", "", "Manager" } );
  25. dt.Rows.Add( new string[] { "9", "2", "Mike Conroy\nAssistant", "", "", "mike.png", "", "Manager" } );
string sResult = hierarchy1.hpcData.LoadFromDataTable( ref dt ); hierarchy1.hpcData.ExpandAll( ); hierarchy1.Refresh( );
Refer: Create Organization Chart From Database/DataTable
See Also