Treeview in Combobox

7 posts, 0 answers
  1. Teoman
    Teoman avatar
    69 posts
    Member since:
    Jan 2009

    Posted 12 Sep 2011 Link to this post

    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>
  2. Cat Cheshire
    Cat Cheshire avatar
    128 posts
    Member since:
    Jun 2010

    Posted 13 Sep 2011 Link to this post

    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
  3. Teoman
    Teoman avatar
    69 posts
    Member since:
    Jan 2009

    Posted 20 Sep 2011 Link to this post

    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.
  4. Teoman
    Teoman avatar
    69 posts
    Member since:
    Jan 2009

    Posted 20 Sep 2011 Link to this post

    its really interesting 9 days past before first post no support team member answer.are they in holiday?
  5. Ivana
    Admin
    Ivana avatar
    657 posts

    Posted 23 Sep 2011 Link to this post

    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
  6. Teoman
    Teoman avatar
    69 posts
    Member since:
    Jan 2009

    Posted 29 Sep 2011 Link to this post

    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();
        }
  7. Ivana
    Admin
    Ivana avatar
    657 posts

    Posted 03 Oct 2011 Link to this post

    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
Back to Top