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

binding selected node value page load

1 Answer 70 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Teoman
Top achievements
Rank 1
Teoman asked on 27 Sep 2011, 03:04 PM
hi,
i have a treeview in combobox.i cant mark as selected treeview default value.i have a value for pdeps.DEPID.ToString(); and tv binding correctly but it gives null exception?Any opinion?

RadTreeView tv = (RadTreeView)cbxDepartments.Items[0].FindControl("tvDepartments");
tv.DataSource = d.GetAllDepartmentsByBranch(branchid);
tv.DataBind();
tv.SelectedNode.Value = pdeps.DEPID.ToString();

1 Answer, 1 is accepted

Sort by
0
Plamen
Telerik team
answered on 30 Sep 2011, 11:42 AM
Hello Teoman,

When the RadTreeView is Loaded there is no selected nod eby default so it is expected the select node property to return null. You will have to select a node before that:
node.Focus();
 node.IsSelected = true;

Hope this will be helpful.

Best wishes,
Plamen Zdravkov
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
Tags
TreeView
Asked by
Teoman
Top achievements
Rank 1
Answers by
Plamen
Telerik team
Share this question
or