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

Treeview in Combobox

6 Answers 96 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Teoman
Top achievements
Rank 1
Teoman asked on 13 Sep 2011, 03:35 AM
Hi,
i am retrieving treeview node text value with your example.but i want to also get selected node value..and i dont have any opinion how can i get multiple value when i use checkbox property true on treeview.Can you show me the way please?
I get the text like this.

<script type="text/javascript">
    function nodeClicking(sender, args) {
        var comboBox = $find("<%= cbxDepartments.ClientID %>");

        var node = args.get_node()

        comboBox.set_text(node.get_text());


        comboBox.trackChanges();
        comboBox.get_items().getItem(0).set_text(node.get_text());
        comboBox.commitChanges();

        comboBox.hideDropDown();

        // Call comboBox.attachDropDown if:
        // 1) The RadComboBox is inside an AJAX panel.
        // 2) The RadTreeView has a server-side event handler for the NodeClick event, i.e. it initiates a postback when clicking on a Node.
        // Otherwise the AJAX postback becomes a normal postback regardless of the outer AJAX panel.

        //comboBox.attachDropDown();
    }

    function StopPropagation(e) {
        if (!e) {
            e = window.event;
        }

        e.cancelBubble = true;
    }

    function OnClientDropDownOpenedHandler(sender, eventArgs) {
        var tree = sender.get_items().getItem(0).findControl("tvDepartments");
        var selectedNode = tree.get_selectedNode();
        if (selectedNode) {
            selectedNode.scrollIntoView();
        }
    }
    </script>

6 Answers, 1 is accepted

Sort by
0
Cat Cheshire
Top achievements
Rank 1
answered on 13 Sep 2011, 11:25 AM
You can use get_checked() property to detect if a treeview node is checked:
http://www.telerik.com/help/aspnet-ajax/treeview-checkboxes-client-side.html
0
Teoman
Top achievements
Rank 1
answered on 20 Sep 2011, 10:02 PM
i want to know that how can i get the checked nodes text values  of the  treeview with js?the code above show the text when i set  CheckBoxes="false" for single value.
0
Teoman
Top achievements
Rank 1
answered on 21 Sep 2011, 04:16 AM
its really interesting 9 days past before first post no support team member answer.are they in holiday?
0
Ivana
Telerik team
answered on 23 Sep 2011, 12:52 PM
Hi Teoman,

In order to find the text values of the checked nodes, you could find the RadTreeView control and iterate through its items where you can make a check if the item's check box is checked or not.

Also, for more information about the client-side programming of the RadComboBox and RadTreeView controls,  you could refer to the following help articles on our website:
RadComboBox: Client-Side Overview and RadTreeView: Client-Side Overview.

Greetings,
Ivana
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
0
Teoman
Top achievements
Rank 1
answered on 29 Sep 2011, 02:50 PM
hi
i have two combobox.first one have treeview inside and the second one is not have.i have to bind the second one with the first one selected value on treeview.i am trying to catch it with treeview's nodeclick event but.it make no sense.any opinion?

 protected void tv_NodeClick(object sender, RadTreeNodeEventArgs e)
    {
        product p = new product();
        RadTreeView tv = (RadTreeView)cbxDepartment.Items[0].FindControl("tvDepartments");
        Guid branchid = new Guid(Session["BRANCHID"].ToString());
        Guid depid = new Guid(e.Node.Value);
        var products = p.GetAllProductFilteredByBranchDepType(branchid, depid);
        cbxProducts.DataSource = products;
        cbxProducts.DataBind();
    }
0
Ivana
Telerik team
answered on 03 Oct 2011, 04:05 PM
Hello Teoman,

One possible solution is to set CustomAttribute (for example you could use the ID of the item) for every item in the RadTreeView control. Having the ID of the currently selected item you could easily get the corresponding data for the first RadComboBox's selected item, and populate the second RadComboBox with it.

To see how custom attributes are made for the RadTreeView, take a look at the following online demo:
RadTreeView: Custom Attributes and/or the online help article: RadTreeView: Custom Attributes Overview.

For more information about the work of the related combos, you could refer to the following demo at our website: RadComboBox: Related Combos.

Best wishes,
Ivana
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
Tags
ComboBox
Asked by
Teoman
Top achievements
Rank 1
Answers by
Cat Cheshire
Top achievements
Rank 1
Teoman
Top achievements
Rank 1
Ivana
Telerik team
Share this question
or