GibboK
GibboK

Reputation: 73998

Web Control TreeView select a Node programmatically

I use asp.net 4 and c#. I have a TreeView and I would like select an existing node programmtically.

SelectNode() method is read only

http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.treeview.selectednode.aspx

so I do not know how to do it. Please reply for a TreeView WEB CONTROL not for Win App.

My Code:

protected void uxTreeView_DataBound(object sender, EventArgs e)
{
    TreeView myTreeView = (TreeView)uxManageSlotsDisplayer.FindControl("uxTreeView");
    myTreeView.Nodes[2].Selected = true;
}

Upvotes: 1

Views: 2342

Answers (1)

Atanas Korchev
Atanas Korchev

Reputation: 30661

You can try setting the Selected property of a particular TreeNode.

Upvotes: 1

Related Questions