I have a TreeView web control on an ASP page. I am programmatically populating all the tree nodes. I want to disable the link on ALL tree nodes. I can do it one at a time, like this (using a string array for simplicity's sake):
for each (string strValue in strValues)
{
TreeNode objNode = new TreeNode(strValue);
objNode.SelectAction = TreeNodeSelectAction.None;
objTreeView.Nodes.Add(objNode);
}
Assume for the sake of argument that I have multiple level of nodes, so there is not a simple way to iterate through all nodes once I am done populating. Is there a property I can set on the TreeView to set SelectAction for all nodes?
TreeView does not support any property to do this. However you can do it by using recursive methods