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

RadTreeview in RadComboBox - display selected node in combo after postback

1 Answer 105 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
test
Top achievements
Rank 1
test asked on 07 Apr 2010, 04:19 PM
Hi,

I'm trying to use a RadTreeview in a RadComboBox, all is good except I want to see the text of my selected node after a postback in the combo. For example in the travelisimo example, if you want to have the name of the selected country in the dropdown after clicking on submit, how would you do (actually after submit I've "choose a destination") ?

Thanks

1 Answer, 1 is accepted

Sort by
0
Veronica
Telerik team
answered on 09 Apr 2010, 02:41 PM
Hi test,

To be able to persist the text of the RadComboBox across postbacks just add this code in pageLoad Javascript function:

function pageLoad()
        {
            var comboBox = $find("<%= RadComboBox1.ClientID %>");
            var tree = comboBox.get_items().getItem(0).findControl("RadTreeView1");
            var selectedNode = tree.get_selectedNode();
            if (selectedNode) {
                comboBox.set_text(selectedNode.get_text());
            }
        }

You may test the full code in the attached .zip file. 


All the best,
Veronica Milcheva
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Tags
TreeView
Asked by
test
Top achievements
Rank 1
Answers by
Veronica
Telerik team
Share this question
or