Node color change Telerik Org chart

2 posts, 0 answers
  1. Sourav
    Sourav avatar
    6 posts
    Member since:
    Apr 2014

    Posted 26 Jun 2014 Link to this post

    Hi there,

     I want to change different node color for different node in telerik ORG chart. Like Node A -> pink, Node B -> Red.

    Can I do this on GroupItemDataBound event ? if yes then please give me some example ..

    Thanks in Advance
    Sourav
  2. Nencho
    Admin
    Nencho avatar
    1457 posts

    Posted 01 Jul 2014 Link to this post

    Hello Sourav,

    You could use the GroupItemDataBound event handler, in order to assign a custom CssClass to the currently evaluated Item. Thus, you could apply the css style rules in your markup and achieve the desired functionality:

    //code-behind
    protected void radOrgChart_GroupItemDataBound(object sender, Telerik.Web.UI.OrgChartGroupItemDataBoundEventArguments e)
      {
          if (e.Item.Text == "Andrew Fuller")
              e.Item.CssClass = "GreenClass";
          else
              e.Item.CssClass = "RedClass";
      }
    //css
    <style type="text/css">
           html .RedClass {
               background-color: red;
           }
     
           html .GreenClass {
               background-color: green;
           }
           html .RadOrgChart_Default .rocItemContent,
           html .RadOrgChart_Default .rocItemTemplate {
               background-image: none;
               background-color: transparent;
           }
       </style>


    Regards,
    Nencho
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
Back to Top