Telerik.Web.UI.OrgChartDrillDownEventArguments.SourceNode.get returns Nothing

1 Answer 11 Views
General Discussions OrgChart
Gerhard Krenn
Top achievements
Rank 1
Gerhard Krenn asked on 18 Aug 2025, 01:51 PM | edited on 18 Aug 2025, 01:53 PM

I try to follow the example in https://demos.telerik.com/aspnet-ajax/orgchart/examples/applicationscenarios/drilldowntoviewdetails/defaultvb.aspx?show-source=true but if I run the code and click on an icon for drill-down I get the error at the line "If e.SourceNode.ID <> "1" Then":

Telerik.Web.UI.OrgChartDrillDownEventArguments.SourceNode.get returned Nothing.

The code is:

  Private Sub RadOrgChart2_DrillDown(sender As Object, e As Telerik.Web.UI.OrgChartDrillDownEventArguments) Handles RadOrgChart2.DrillDown
      If e.SourceNode.ID <> "1" Then
          Dim item = New OrgChartGroupItem()
          e.SourceNode.Renderer.Controls.Remove(e.SourceNode.Nodes.Renderer)
          e.SourceNode.GroupItems.Clear()
          e.SourceNode.Nodes.Clear()
          e.SourceNode.GroupItems.Add(item)
      End If
  End Sub

Please advise!

Thx
Gerhard

1 Answer, 1 is accepted

Sort by
0
Rumen
Telerik team
answered on 19 Aug 2025, 09:32 AM

Hi Gerhard,

Thanks for the details. The exception “OrgChartDrillDownEventArguments.SourceNode.get returned Nothing” means the server could not resolve the clicked node during the drill‑down postback. This occurs when the RadOrgChart’s server-side node tree is not available at the moment the control processes the drill‑down command.

Common causes

  • Data binding timing – The chart was bound only on initial load (Not IsPostBack). On the drill‑down postback the chart has no data, so e.SourceNode is Nothing.
  • Control ID mismatch – The handler targets RadOrgChart2 but the markup/binding uses a different ID (e.g., RadOrgChart1).
  • Drill‑down not enabledEnableDrillDown="true" is missing or set on a different chart instance.

How to fix

  1. Bind the chart on every request (or bind early in Page_Init) so the server tree exists before DrillDown runs.
  2. Ensure IDs match across markup, binding code, and the handler’s Handles clause.
  3. Add a small safety check in the handler to guard against unexpected nulls.
  4. If the OrgChart is ajaxified, test by disabling the Ajax with EnableAjax="false" inside the RadAjaxManager/RadAjaxPanel and see if there are JS errors in the console.

Markup (ID must match the handler)

<telerik:RadOrgChart runat="server"
                     ID="RadOrgChart2"
                     RenderMode="Lightweight"
                     EnableDrillDown="true"
                     DisableDefaultImage="true"
                     Skin="Default" />

Code-behind (bind on every request)

Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
    Dim employees = New DataTable()
    employees.Columns.Add("TeamID")
    employees.Columns.Add("ReportsTo")
    employees.Columns.Add("Team")
    employees.Rows.Add("1", DBNull.Value, "Company Name")
    employees.Rows.Add("ANTON", "1", "Antonio Moreno")
    employees.Rows.Add("BLONP", "ANTON", "Frédérique Citeaux")
    employees.Rows.Add("AROUT", "ANTON", "Thomas Hardy")
    employees.Rows.Add("BLAUS", "ANTON", "Hanna Moos")
    employees.Rows.Add("COMMI", "AROUT", "Pedro Afonso")
    employees.Rows.Add("CACTU", "AROUT", "Patricio Simpson")

    RadOrgChart2.DataSource = employees
    RadOrgChart2.DataFieldID = "TeamID"
    RadOrgChart2.DataFieldParentID = "ReportsTo"
    RadOrgChart2.DataTextField = "Team"
    RadOrgChart2.DataBind()
End Sub

Private Sub RadOrgChart2_DrillDown(sender As Object, e As Telerik.Web.UI.OrgChartDrillDownEventArguments) _
    Handles RadOrgChart2.DrillDown

    Dim node = e.SourceNode
    If node Is Nothing Then Return ' guard

    If node.ID <> "1" Then
        Dim item = New OrgChartGroupItem() With {.Template = New EmployeeInfo(node.ID)}
        node.Renderer.Controls.Remove(node.Nodes.Renderer)
        node.GroupItems.Clear()
        node.Nodes.Clear()
        node.GroupItems.Add(item)
    End If
End Sub

Attached sample

I have attached a runnable sample website that binds from an in‑memory DataTable and includes the drill‑down template. It runs as‑is (no database) and demonstrates the expected behavior without the SourceNode error. Open the solution, set the sample page as the start page, and run.

If the issue persists after the above changes, please share:

  • Your chart markup (ID and EnableDrillDown value)
  • Where/when the chart is bound (Page_Init or Page_Load)
  • Whether multiple charts exist on the page or the chart is inside AJAX containers

 

Regards,
Rumen
Progress Telerik

Stay tuned by visiting our public roadmap and feedback portal pages! Or perhaps, if you are new to our Telerik family, check out our getting started resources
Tags
General Discussions OrgChart
Asked by
Gerhard Krenn
Top achievements
Rank 1
Answers by
Rumen
Telerik team
Share this question
or