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 uxTr开发者_运维百科eeView_DataBound(object sender, EventArgs e)
{
TreeView myTreeView = (TreeView)uxManageSlotsDisplayer.FindControl("uxTreeView");
myTreeView.Nodes[2].Selected = true;
}
You can try setting the Selected property of a particular TreeNode.
精彩评论