RadTreeView inside Radcombox

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

    Posted 20 Nov 2013 Link to this post

    Hi guys,
    I have a following code in my aspx page:
    <telerik:RadComboBox ID="RadComboBoxStatusGrp" runat="server" Width="125px"
                 Height="150px" Font-Size="Small" CssClass="txtinput" AutoPostBack="false"
                 EmptyMessage="Choose a Status" ShowToggleImage="true"
                  OnClientDropDownOpened="OnClientDropDownOpenedHandler">

                 
          <ItemTemplate>
           <div id="div1">
           <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>
           </div>
          </ItemTemplate>
          <Items>
            <telerik:RadComboBoxItem Text="" />
          </Items>
         </telerik:RadComboBox>
          <script type="text/javascript">
              var div1 = document.getElementById("div1");
              div1.onclick = StopPropagation;
                </script>
    When I ran first time my application I choose node("Approved") and click on it and this node appear in the combobox, I click search button and everything is working fine but next time  I want to choose the other node("Entered") and when I click once but this node  not showing in combobox I need to click it again to get this node show in combobox.

    Please help me,
    Thanks
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 21 Nov 2013 Link to this post

    Hi Vitaly,

    Please have a look into the following code snippet to set RadTreeNode as the Selected Item of RadComboBox.

    ASPX:
    <telerik:RadComboBox ID="RadComboBoxStatusGrp" runat="server" Width="125px" Height="150px"
        Font-Size="Small" CssClass="txtinput" AutoPostBack="false" EmptyMessage="Choose a Status"
        ShowToggleImage="true">
        <ItemTemplate>
            <div id="div1">
                <telerik:RadTreeView runat="server" ID="RadTreeView1" OnClientNodeClicked="OnClientNodeClicked">
                    <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>
            </div>
        </ItemTemplate>
        <Items>
            <telerik:RadComboBoxItem Text="" />
        </Items>
    </telerik:RadComboBox>

    JavaScript:
    <script type="text/javascript">
        function OnClientNodeClicked(sender, args) {
            var combo = $find("<%=RadComboBoxStatusGrp.ClientID %>");
            combo.set_text(args.get_node().get_text());
        }
    </script>

    Thanks,
    Shinu.
Back to Top