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

How to get the only leaf nodes selected values in raddropdowntree ?

2 Answers 324 Views
DropDownTree
This is a migrated thread and some comments may be shown as answers.
SR
Top achievements
Rank 1
SR asked on 16 Jan 2014, 10:27 AM
How to get the selected values leaf nodes of raddropdown tree  with chceck boxes .
when  i am click to save button pass only leaf node values using comma separated  string ..


 
Thanks!

2 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 17 Jan 2014, 03:28 AM
Hi Suman,

Please have a look into the following code snippet to achieve your scenario.

ASPX:
<telerik:RadDropDownTree ID="RadDropDownTree1" runat="server" DataFieldID="id" DataFieldParentID="parentid"
    CheckBoxes="CheckChildNodes" DataTextField="text" DataSourceID="SqlDataSource2">
</telerik:RadDropDownTree>
<telerik:RadButton ID="RadButton2" runat="server" Text="Save" OnClick="RadButton2_Click">
</telerik:RadButton>

C#:
protected void RadButton2_Click(object sender, EventArgs e)
{
    StringBuilder sb = new StringBuilder();
    foreach (RadTreeNode node in RadDropDownTree1.EmbeddedTree.CheckedNodes)
    {
        if (node.Nodes.Count == 0)
        {
            sb.Append(node.Text + ", ");
        }
    }
    string text = sb.ToString();
}

Thanks,
Princy.
0
SR
Top achievements
Rank 1
answered on 17 Jan 2014, 05:52 AM
Hi Princy,

Thanks for your quick response finally i cracked the issue ..,


Regards,
Suman.


 
Tags
DropDownTree
Asked by
SR
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
SR
Top achievements
Rank 1
Share this question
or