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

RadTreeView, RadComboBox and PostBack

1 Answer 102 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Marco Minerva
Top achievements
Rank 1
Marco Minerva asked on 09 Oct 2008, 09:14 AM
Hi all!

I have created a RadComboBox with a RadTreeView, like the one in the example that is shipped with RadControls. Now I would like that the text of the ComboBox is persisted between PostBack. Is it possible?

Thanks.
--
Marco Minerva [MCPD], marco.minerva@gmail.com
http://blogs.ugidotnet.org/marcom

1 Answer, 1 is accepted

Sort by
0
Simon
Telerik team
answered on 09 Oct 2008, 01:19 PM
Hello Marco,

You can store the text of the Selected Node as a Value of the one Item of the ComboBox. Using track/commitChanges in this case will persist the Value across postbacks. On load of the ComboBox you can restore its text from its Item's Value.

<telerik:RadComboBox ID="RadComboBox1" runat="server" Height="140px" Width="215px" 
    ShowToggleImage="True" Skin="WebBlue" style="vertical-align:middle;" 
    OnClientLoad="comboLoad"

                              function comboLoad(sender, eventArgs) 
            { 
                sender.set_text(sender.get_items().getItem(0).get_value()); 
            } 
             
            function nodeClicking(sender, args) 
            { 
                var comboBox = $find("<%= RadComboBox1.ClientID %>"); 
                 
                var node = args.get_node() 
                 
                comboBox.set_text(node.get_text()); 
                 
                comboBox.trackChanges(); 
                comboBox.get_items().getItem(0).set_value(node.get_text()); 
                comboBox.commitChanges(); 
                 
                comboBox.hideDropDown(); 
            } 

I hope this helps.

Greetings,
Simon
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
TreeView
Asked by
Marco Minerva
Top achievements
Rank 1
Answers by
Simon
Telerik team
Share this question
or