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

RadTreeView inside Radcombox

1 Answer 9 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Vitaly
Top achievements
Rank 1
Vitaly asked on 20 Nov 2013, 11:23 PM
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

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 1
answered on 21 Nov 2013, 07:16 AM
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.
Tags
General Discussions
Asked by
Vitaly
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 1
Share this question
or