Programmatic Nodes

7 posts, 0 answers
  1. Matthew
    Matthew avatar
    51 posts
    Member since:
    Oct 2012

    Posted 28 Feb 2013 Link to this post

    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
  2. Plamen
    Admin
    Plamen avatar
    2734 posts

    Posted 05 Mar 2013 Link to this post

    Hi Matthew,

     
    A similar functionality is implemented in this on-line demo.

    Hope this will be helpful.

    Greetings,
    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Matthew
    Matthew avatar
    51 posts
    Member since:
    Oct 2012

    Posted 05 Mar 2013 Link to this post

    Forgive me. I don't want group nodes--at all. Something similar to this in appearance. I have to selectively add templates, so I have to make the nodes in the code behind, but it seems I can only make group nodes.
  5. Matthew
    Matthew avatar
    51 posts
    Member since:
    Oct 2012

    Posted 07 Mar 2013 Link to this post

    Simplified, this is what I'm doing. The initial call passes in the OrgChart as parent.
    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.
  6. Plamen
    Admin
    Plamen avatar
    2734 posts

    Posted 08 Mar 2013 Link to this post

    Hello Matthew,

     
    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.
  7. Matthew
    Matthew avatar
    51 posts
    Member since:
    Oct 2012

    Posted 08 Mar 2013 Link to this post

    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.
  8. Plamen
    Admin
    Plamen avatar
    2734 posts

    Posted 13 Mar 2013 Link to this post

    Hello,

     
    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.

    All the best,
    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.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017