I'm creating a dependency tree programmatically in code-behind. Overall, it works. Unfortunately, they all show up as group nodes. Could you please provide an examples of how to programmatically add a single item as opposed to a group node? Thanks.
Matthew Ricks
Matthew Ricks
6 Answers, 1 is accepted
0
Hi Matthew,
Plamen
the Telerik team
A similar functionality is implemented in this on-line demo.
Hope this will be helpful.
Plamen
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
0
Matthew
Top achievements
Rank 1
answered on 08 Mar 2013, 12:01 AM
Simplified, this is what I'm doing. The initial call passes in the OrgChart as parent.
Again, I don't want group nodes (the gray borders), I just want normal nodes. I've attached what I've currently got. Keep in mind this uses the extended function. What I've given should show what I'm doing, and, more importantly, what I'm doing wrong.
private void LoadServiceNode(IOrgChartNodeContainer parent, int serviceID)
{
if (services.Count(s => s.ServiceID == serviceID) == 0) return;
Service service = services.First(s => s.ServiceID == serviceID);
services.Remove(service);
OrgChartNode snode = new OrgChartNode();
snode.GroupItems.Add(new OrgChartGroupItem { CssClass = "Service", DataItem = service, Template = new ServiceTemplate() });
// Load Required Services
if (service.Dependencies.Count > 0)
{
OrgChartNode node = new OrgChartNode();
node.GroupItems.Add(new OrgChartGroupItem { CssClass = "Service", DataItem = service, Template = new ServicesTemplate() });
foreach (Service dependency in service.Dependencies.OrderBy(s => s.RequiredService.ServiceLaunchDate).Select(d => d.RequiredService))
{
LoadServiceNode(node, dependency.ServiceID);
}
if (node.Nodes.Count > 0) snode.Nodes.Add(node);
}
snode.Collapsed = true;
parent.Nodes.Add(snode);
}
Again, I don't want group nodes (the gray borders), I just want normal nodes. I've attached what I've currently got. Keep in mind this uses the extended function. What I've given should show what I'm doing, and, more importantly, what I'm doing wrong.
0
Hello Matthew,
Hope this will be helpful.
Kind regards,
Plamen
the Telerik team
If you are trying to remove the background grey color that surrounds the nodes you can achieve it with css as in the code below or with setting some other color:
<style type=
"text/css"
>
.rocGroup {
background-color
:
transparent
!important
;
}
</style>
Hope this will be helpful.
Kind regards,
Plamen
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Matthew
Top achievements
Rank 1
answered on 08 Mar 2013, 03:22 PM
I'm not just trying to remove the color. You solution leaves a gap around the nodes, the lines don't go all the way, and if I try to compensate the arrows and/or lines get out of whack. I've attached a sample of what I've been able to do with CSS. Is there not a programmatic way to add a regular node instead of a group node?
And by the way, I don't know if others experience this issue, but the postbacks after submitting replies like this take an unreasonably long time for me. It'd be nice if that weren't the case.
And by the way, I don't know if others experience this issue, but the postbacks after submitting replies like this take an unreasonably long time for me. It'd be nice if that weren't the case.
0
Hello,
Plamen
the Telerik team
If you want to have regular nodes I will recommend you to use simple binding as for example it is done in this on-line demo or if you are using load on demand this on-line demo instead of using group enabled.
As for the issue with the Postback after submitting replies -we will investigate the issue-thank you for reporting it.
Plamen
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.