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: 5.1.0.0 (5.1.0)
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

DataTable dt = new DataTable( );
//Refer the following link for column information: 
//http://unifosys.com/hierarchy-chart/Create_Organization_Chart_From_Database_Sample.html 
//column names are not important; but order of columns is.
dt.Columns.Add( "id" );
dt.Columns.Add( "pid" );
dt.Columns.Add( "txt" );            
dt.Columns.Add( "value" );
dt.Columns.Add( "tooltip" );
dt.Columns.Add( "imagefile" );
dt.Columns.Add( "url" );
dt.Columns.Add( "category" );

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*/ } );
dt.Rows.Add( new string[] { "2", "6", "Fahad M.\nAdministration", "NULL", "NULL", "fahad.png", "", "Manager" } );
dt.Rows.Add( new string[] { "3", "1", "Palm Blazer\nCustomer Care", "NULL", "tooltip1", "palm.png", "", "Executive" } );
dt.Rows.Add( new string[] { "4", "", "Steve Bullock\nDevelopment", "NULL", "NULL", "steve.png", "", "Director" } );
dt.Rows.Add( new string[] { "5", "2", "Kendra Spring\nAssistant", "NULL", "NULL", "kendra.png", "", "Executive" } );hierarchy1.Refresh( );
dt.Rows.Add( new string[] { "6", "", "Shelly Tylor\nSales\nAdministration", "NULL", "NULL", "shelly.png", "", "Director" } );
dt.Rows.Add( new string[] { "7", "4", "Mike Rupert\nNULL", "NULL", "NULL", "mike1.png", "", "Manager" } );
dt.Rows.Add( new string[] { "8", "4", "Meg Steve\nNULL", "NULL", "NULL", "meg.png", "", "Manager" } );
dt.Rows.Add( new string[] { "9", "2", "Mike Conroy\nAssistant", "NULL", "NULL", "mike.png", "", "Manager" } );
string sResult = hierarchy1.hpcData.LoadFromDataTable( ref dt );
hierarchy1.hpcData.ExpandAll( );
hierarchy1.Refresh( );
See Also