This is a migrated thread and some comments may be shown as answers.

Show Upto Three Levels of nodes

3 Answers 75 Views
OrgChart
This is a migrated thread and some comments may be shown as answers.
Mohammed
Top achievements
Rank 1
Mohammed asked on 23 Sep 2014, 07:01 AM
Hello,
I'm developing a online application with 'radOrgChart'. I have loaded the data to this radOrgChart from linqDataSource. On clicking any of the node, i need to re-display the radOrgChart as the clicked node as parent as in drill-down method. I have tested this drill-down method. But, i'm looking for different method. Instead of drill-down, i need a to click any node or a buttton inside the radOrgChart node to view. Then, while loading the page it shows all the nodes, instead of that, i need to display the parent and its child's only. Others needed to be collapsed. I check all the examples provided by telerik. It collapse using code-behind or in html setting attribute called colapsed="true" in radOrgChart. Here, i will submit my code and the screen shots. OrgChart-1 is the page when it loads before. And, OrgChart-2 is the page what i needs to be shown on page load.

<head runat="server">
    <title></title>
    <style type="text/css">
        .orgChartDiv {
            background-color: #e4e4e4;
            height: 100%;
            width: 100%;
            overflow-y: auto;
            float: left;
            position: relative;
        }
    </style>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    <telerik:RadScriptManager runat="server" ID="RadScriptManager1" />
 
        <div class="orgChartDiv">
            <telerik:RadOrgChart ID="employeeOrgChart" runat="server" Skin="Default" EnableCollapsing="true" Width="100%"
                DataSourceID="LinqDataSource_Employee" DataTextField="FirstName" DataFieldID="EmployeeID" DataFieldParentID="ReportsTo"
                EnableGroupCollapsing="true" >
            </telerik:RadOrgChart>
        </div>
    </div>
    </form>
    <asp:LinqDataSource runat="server" ID="LinqDataSource_Employee"
        ContextTypeName="RadOrgChart.RealDataDataContext" TableName="Employees" />
</body>


With Regards,
Mohammed Rafsanjany

3 Answers, 1 is accepted

Sort by
0
Plamen
Telerik team
answered on 26 Sep 2014, 05:46 AM
Hi Mohammed ,

You can use the NodeDataBound event and set the node expanded property according to your scenario as for example in the code below:
protected void RadOrgChart1_NodeDataBound(object sender, OrgChartNodeDataBoundEventArguments e)
   {
       e.Node.Collapsed = true;
   }

Hope this will help you solve the issue.

Regards,
Plamen
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.

 
0
Mohammed
Top achievements
Rank 1
answered on 01 Oct 2014, 08:29 AM
Hi Plamen,
Thank you for your support.
I tried the idea you have given. But it collapse all nodes.
I need to show the first node (parent node) and it childrens only. Those children coming under second should be collapsed.


And,
Can i get drill-down click event code-behind.

With Regards,
Mohammed Rafsanjany
0
Plamen
Telerik team
answered on 01 Oct 2014, 01:31 PM
Hello Mohammed,

You can check the level of the node and not collapse it in case you don't want it to. 

As for the second questions you can use the onDrillDown event of the RadOrgChart.

Regards,
Plamen
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.

 
Tags
OrgChart
Asked by
Mohammed
Top achievements
Rank 1
Answers by
Plamen
Telerik team
Mohammed
Top achievements
Rank 1
Share this question
or