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

RadTreeView reference to Parent RadComboBox

2 Answers 108 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Thomas Scheelhardt
Top achievements
Rank 1
Thomas Scheelhardt asked on 12 Sep 2008, 11:51 AM
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 Answers, 1 is accepted

Sort by
0
Veselin Vasilev
Telerik team
answered on 15 Sep 2008, 02:30 PM
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.
0
msigman
Top achievements
Rank 2
answered on 15 Mar 2013, 03:04 AM
After 5 years this same solution still helped me.  Thanks!
Tags
TreeView
Asked by
Thomas Scheelhardt
Top achievements
Rank 1
Answers by
Veselin Vasilev
Telerik team
msigman
Top achievements
Rank 2
Share this question
or