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

Default Selected Node

2 Answers 210 Views
DropDownTree
This is a migrated thread and some comments may be shown as answers.
Mike
Top achievements
Rank 1
Mike asked on 20 May 2014, 03:50 PM
I have a RadDropDownTree control on a page, I can successfully bind data to it [and read back the selected node's value], and I can successfully set the value BACK on loading a form.  However, when I programmatically set the selected node, it doesn't show up on the page.  I have to manually expand the DropDownTree and select the already selected item.

How can I have the DropDownTree ACTUALLY select the node programmatically?

I'm using Telerik ASP.NET AJAX v2014.1403.45

2 Answers, 1 is accepted

Sort by
0
Accepted
Shinu
Top achievements
Rank 2
answered on 21 May 2014, 04:40 AM
Hi Mike,

Please have a look into the sample code snippet to select a node a programmatically.

ASPX:
<telerik:RadDropDownTree runat="server" ID="RadDropDownTreeTest" DataTextField="LastName"
    DataFieldParentID="ReportsTo" DataFieldID="EmployeeID" DataValueField="EmployeeID"
    DataSourceID="SqlDataSource2"  OnDataBound="RadDropDownTreeTest_DataBound">
    <DropDownSettings OpenDropDownOnLoad="true" />
</telerik:RadDropDownTree>

C#:
protected void RadDropDownTreeTest_DataBound(object sender, EventArgs e)
{
    ((RadDropDownTree)sender).ExpandAllDropDownNodes();
    RadDropDownTreeTest.SelectedText = "Davolio";
            //OR
    RadDropDownTreeTest.SelectedValue = "3";
}

Thanks,
Shinu.
0
Mike
Top achievements
Rank 1
answered on 21 May 2014, 02:47 PM
Awesome, that solved my issue, thanks!
Tags
DropDownTree
Asked by
Mike
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Mike
Top achievements
Rank 1
Share this question
or