Access the Containing Node of a Templated Control

3 posts, 0 answers
  1. Marbry
    Marbry avatar
    123 posts
    Member since:
    Aug 2012

    Posted 05 Jun 2012 Link to this post

    Is there a way to reference the containing tree node of a template generated control on the client side, a radcombobox in this case?  Without using the Find methods.

    Those depend on knowing a particular value rather than the relationship of the node and control.  I have a client function that is a handler for the radcombobox OnClientSelectedIndexChanged event, but within that I need to also get a reference to the containing tree node.
  2. Bozhidar
    Admin
    Bozhidar avatar
    1101 posts

    Posted 08 Jun 2012 Link to this post

    Hello Marbry,

    The TreeView has a function that can get a reference to the node object if you pass in any of the elements inside the node as an argument. In your case, you can use this function in the following way:
    function onClientSelectedIndexChanged(sender, args) {
        var comboElement = sender.get_element();
        var tree = $find("RadTreeView1");
        var node = tree._extractNodeFromDomElement(comboElement);
        console.log(node.get_text());
    }

     
    Regards,
    Bozhidar
    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. UI for ASP.NET Ajax is Ready for VS 2017
  4. Marbry
    Marbry avatar
    123 posts
    Member since:
    Aug 2012

    Posted 08 Jun 2012 Link to this post

    Perfect, that's exactly what I needed.

    Thank you.
Back to Top