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

Rebind Data on Drill Down

3 Answers 114 Views
OrgChart
This is a migrated thread and some comments may be shown as answers.
Alanm
Top achievements
Rank 2
Alanm asked on 23 Aug 2012, 12:58 PM
I've got a large organisation so can't construct a single data source that has all the organisation in it, it takes too long to generate.  So I've got code that can retrieve just a number of levels of data from a specified root node.  I then change the datasource in the DrillDown event to just the correct data for that drill down and DataBind().

My problem is the org chart doesn't change to reflect the new datasource. Its doesn't do anything, just shows the single node i drilled into despite having new data that has the nodes children in it.

How can I change the data on drilldown, so I can collect it in bits?

3 Answers, 1 is accepted

Sort by
0
Peter Filipov
Telerik team
answered on 27 Aug 2012, 07:49 AM
Hello Alan,

You could use DrillDown server event. In case that you are facing some difficulties please provide me a runnable project for a local test.

Regards,
Peter Filipov
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
Alanm
Top achievements
Rank 2
answered on 30 Aug 2012, 09:41 AM
Here is a demo of what I mean.  I bind Nodes 1,2,3 at the start.  Then drill into Node 3, which triggers the DrillDown Event.  In the DrillDown Event I then want to rebind the data source to show nodes 3,4,5.  It doesn't work in only shows node 3.

I've tried not binding on page_load for postbacks and it also errors.

  <div style="overflow: scroll;">
    <telerik:RadAjaxLoadingPanel runat="server" ID="RadLoadingPanel1" Skin="Telerik"></telerik:RadAjaxLoadingPanel>
        <telerik:RadAjaxPanel runat="server" ID="RadAjaxPanel1" LoadingPanelID="RadLoadingPanel1">
        <telerik:RadOrgChart runat="server" ID="RadOrgChart1" EnableDrillDown="true">
            <ItemTemplate>
                <strong><%# DataBinder.Eval(Container, "Text") %></strong>
            </ItemTemplate>
        </telerik:RadOrgChart>
    </telerik:RadAjaxPanel>
</div>

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
    Dim items As New List(Of SiteDataItem)
 
    items.Add(New SiteDataItem("1", 1, 1, 0))
    items.Add(New SiteDataItem("2", 2, 2, 1))
    items.Add(New SiteDataItem("3", 3, 3, 2))
 
    RadOrgChart1.DataTextField = "Text"
    RadOrgChart1.DataFieldID = "ID"
    RadOrgChart1.DataFieldParentID = "ParentID"
    RadOrgChart1.DataSource = items
    RadOrgChart1.DataBind()
End Sub
 
Protected Sub RadOrgChart1_DrillDown(sender As Object, e As Telerik.Web.UI.OrgChartDrillDownEventArguments) Handles RadOrgChart1.DrillDown
 
    Dim items As New List(Of SiteDataItem)
 
    items.Add(New SiteDataItem("3", 3, 3, 2))
    Items.Add(New SiteDataItem("4", 4, 4, 3))
    Items.Add(New SiteDataItem("5", 5, 5, 4))
 
    RadOrgChart1.DataSource = items
    RadOrgChart1.DataBind()
 
End Sub
 
Friend Class SiteDataItem
    Private _text As String
    Private _id As Integer
    Private _height As Integer
    Private _parentId As Integer
 
    Public Sub New(text As String, id As Integer, height As Integer, parent As Integer)
        Me.Text = text
        Me.ID = id
        Me.Height = height
        Me.ParentID = parent
    End Sub
 
    Public Property Text() As String
        Get
            Return _text
        End Get
        Set(ByVal value As String)
            _text = value
        End Set
    End Property
 
    Public Property Height() As Integer
        Get
            Return _height
        End Get
        Set(ByVal value As Integer)
            _height = value
        End Set
    End Property
 
    Public Property ID() As Integer
        Get
            Return _id
        End Get
        Set(ByVal value As Integer)
            _id = value
        End Set
    End Property
 
    Public Property ParentID() As Integer
        Get
            Return _parentId
        End Get
        Set(ByVal value As Integer)
            _parentId = value
        End Set
    End Property
 
    Public Sub New(ByVal id As Integer, ByVal parentId As Integer, ByVal text As String)
        _id = id
        _parentId = parentId
        _text = text
    End Sub
End Class


0
Peter Filipov
Telerik team
answered on 03 Sep 2012, 12:56 PM
Hello Alan,

For now, RadOrgChart does not support such scenario. We are going to try to improve its implementation and make it possible for the next releases. Until then I suggest to use the approach described in the following demo.

Regards,
Peter Filipov
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.
Tags
OrgChart
Asked by
Alanm
Top achievements
Rank 2
Answers by
Peter Filipov
Telerik team
Alanm
Top achievements
Rank 2
Share this question
or