RadTreeView reference to Parent RadComboBox

3 posts, 0 answers
  1. Thomas Scheelhardt
    Thomas Scheelhardt avatar
    5 posts
    Member since:
    Jan 2006

    Posted 12 Sep 2008 Link to this post

    Hi,

    I have the need to make a combobox witth a treeview in it, and have looked at the example given in the live samples.
    However the samples use a hardcoded id when referencing the combobox in the NodeClicking handler.

    function nodeClicking(sender, args)
    {
                var comboBox = $find('RadComboBox1');
                var node = args.get_node()
                
                comboBox.set_text(node.get_text());
                
                comboBox.hideDropDown();
    }

    This is not usable for a real world control as one might want multiple such controls on the same page.
    So I need to be able to send the nodeClicking handler the id of the combobox, so that I can register the javascript on the page once.

    Thanks in advance,
    Thomas Scheelhardt
  2. Veselin Vasilev
    Admin
    Veselin Vasilev avatar
    2992 posts

    Posted 15 Sep 2008 Link to this post

    Hello Thomas Scheelhardt,

    Here is how you can find the instance of  the combobox in hte OnClientNodeClicking event:

    <script type="text/javascript">  
    function OnClientNodeClickingHandler(sender, e)  
    {     
        var id = sender.get_id();  
        var index = id.indexOf("_i");  
        if (index > -1)  
        {  
            id = id.substr(0, index);  
        }  
        var combo = $find(id);   
    }  
    </script> 

    I hope this helps.

    Best wishes,
    Veskoni
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. msigman
    msigman avatar
    141 posts
    Member since:
    Apr 2008

    Posted 14 Mar 2013 Link to this post

    After 5 years this same solution still helped me.  Thanks!
Back to Top