Hi,
I am trying to use Expand / Collapse feature of Org Chart control. My data source not necessarily have absolute hierarchy as shown in example ( Record with id 1 and 7 doesn't have manager id).
My data binds with the control perfectly, but the expand / collapse feature doesn't work.
I am trying to use Expand / Collapse feature of Org Chart control. My data source not necessarily have absolute hierarchy as shown in example ( Record with id 1 and 7 doesn't have manager id).
My data binds with the control perfectly, but the expand / collapse feature doesn't work.
Protected
Sub
Test_TestOrgChart_Load(sender
As
Object
, e
As
System.EventArgs)
Handles
Me
.Load
BindOrgChart()
End
Sub
Private
Sub
BindOrgChart(
Optional
ByVal
ExpandAll
As
Boolean
=
True
)
Dim
employees = CreateEmployees()
RadOrgChartEmployees.DataFieldID =
"EmployeeID"
RadOrgChartEmployees.DataTextField =
"EmployeeName"
RadOrgChartEmployees.DataFieldParentID =
"ManagerID"
RadOrgChartEmployees.DataSource = employees
RadOrgChartEmployees.DataBind()
If
ExpandAll
Then
RadOrgChartEmployees.ExpandAllNodes()
Else
RadOrgChartEmployees.CollapseAllNodes()
End
If
End
Sub
Private
Function
CreateEmployees()
As
DataTable
Dim
employees =
New
DataTable()
employees.Columns.Add(
"EmployeeID"
)
employees.Columns.Add(
"ManagerID"
)
employees.Columns.Add(
"EmployeeName"
)
employees.Columns.Add(
"JobTitle"
)
employees.Rows.Add(
New
String
() {
"1"
,
Nothing
,
"Emp CEO"
,
"CE0"
})
employees.Rows.Add(
New
String
() {
"2"
,
"1"
,
"Emp President BSS"
,
"President BSS"
})
employees.Rows.Add(
New
String
() {
"3"
,
"1"
,
"Emp COO"
,
"COO"
})
employees.Rows.Add(
New
String
() {
"4"
,
"2"
,
"Emp VP ST"
,
"VP Software Tech"
})
employees.Rows.Add(
New
String
() {
"5"
,
"2"
,
"EMP Director SD"
,
"Director Software Development"
})
employees.Rows.Add(
New
String
() {
"6"
,
"5"
,
"EMP Developer"
,
"Developer"
})
employees.Rows.Add(
New
String
() {
"7"
,
Nothing
,
"EMP CFO"
,
"CFO"
})
employees.Rows.Add(
New
String
() {
"8"
,
"7"
,
"EMP President IT"
,
"President IT"
})
Return
employees
End
Function