RadTreeview in RadComboBox

2 posts, 0 answers
  1. Vitaly
    Vitaly  avatar
    77 posts
    Member since:
    Aug 2011

    Posted 14 Feb 2014 Link to this post

    Good morning guys,
    In my aspx page I have the following code:
    <telerik:RadTreeView runat="server" ID="RadTreeView1" OnClientNodeClicking="nodeClicking">
            <Nodes>
              <telerik:RadTreeNode runat="server" Text="All Trans" Expanded="true" >
               <Nodes>
                <telerik:RadTreeNode runat="server" Text="Approved"    >
                </telerik:RadTreeNode>
                 <telerik:RadTreeNode runat="server" Text="Entered"   >
                 </telerik:RadTreeNode>
                             
                </Nodes>
                </telerik:RadTreeNode>
                </Nodes>  
                <Nodes>
                 <telerik:RadTreeNode runat="server" Text="Processed" ></telerik:RadTreeNode>
                </Nodes>
                <Nodes>
                 <telerik:RadTreeNode runat="server" Text="All" ></telerik:RadTreeNode>
                </Nodes>  
           </telerik:RadTreeView>

    In my code behind I have the followign code to disable treenode:
    string runFl = dt.Rows[0][4].ToString();
    if (runFl == "I")
                        {
                            RadTreeView tree = (RadTreeView)RadComboBoxStatusGrp.Items[0].FindControl("RadTreeView1");
                            tree.FindNodeByText("Processed").Enabled = false;

    "Processed" node get disable but when I click on this disable node it is appearing in combobox.
    My question is:when I click on it I do not want to see this node in combobox at all.

    Thanks guys for your help.
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 16 Feb 2014 in reply to Vitaly Link to this post

    Hi Vitaly,

    Please try the following JavaScript code snippet to achieve your scenario.

    JavaScript:
    <script type="text/javascript">
        function nodeClicking(sender, args) {
            var comboBox = $find("<%= RadComboBoxStatusGrp.ClientID %>");
            var node = args.get_node()
            if (node.get_isEnabled() == true) {
                comboBox.set_text(node.get_text());
                comboBox.trackChanges();
                comboBox.get_items().getItem(0).set_text(node.get_text());
                comboBox.commitChanges();
                comboBox.hideDropDown();
            }
        }
    </script>

    Let me know if you have any concern.
    Thanks,
    Shinu.
Back to Top