NodeExpand event is providing the wrong node value when using NodeTemplate

2 posts, 0 answers
  1. Mikhail
    Mikhail avatar
    3 posts
    Member since:
    Mar 2012

    Posted 05 Jul 2012 Link to this post


    I am using  Telerik version: 2009.3.1208.0

    My task is to add an arrow to the node (on the right side of the node) so people can left-click on it and access context menu. See picture attached.

    I was able to to do that through creating a nodetemplate (subscribing to an interface) and then assigning my class to NodeTemplate property (on Page Init) 

    Here is the code:

    Imports System.Web.UI
    Imports System.Web.UI.WebControls
    Imports Telerik.Web.UI
        Public Class MyNodeTemplate
            Implements ITemplate
            Public Sub InstantiateIn(ByVal container As Control) Implements ITemplate.InstantiateIn
                Dim newLabel As New Label()
                newLabel.CssClass = "nodeLabel"
                newLabel.Text = DirectCast(container, RadTreeNode).Text
                Dim arrowDiv As New System.Web.UI.HtmlControls.HtmlGenericControl("DIV")
                arrowDiv.Attributes.Add("class", "nodeRightClickArrow")
                arrowDiv.Attributes.Add("onclick", "LeftClickContextMenuClick(event, this);")
            End Sub
        End Class

    Everything seems fine EXCEPT:

    When expanding one of the nodes, the NodeExpand Event sends the wrong value for the node that is being expanded. For example, if I expand Node 3, it gives me value (e.Node.Value)  for Node 1. See attached picture for more explanation. As a result wrong child nodes are loaded.


    1) Why NodeExpand is broken when NodeTemplate is being added ?
    2) Any way to achieve  adding an arrow to the node so people can left-click on it without overwriting NodeTemplate?
  2. Plamen
    Plamen avatar
    2725 posts

    Posted 10 Jul 2012 Link to this post

    Hello Makhail,

    I tested the issue and it worked properly at my side with the latest version of our controls so it may be a bug that have been fixed. I am attaching my test project. You can also consider the second way of using templates that is described in the bottom part of this help article.

    Hope this will be helpful.

    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. DevCraft R3 2016 release webinar banner
Back to Top