Reputation: 79
I just coded as below to expand a selected node after a postback. But it is not working. What am I missing?
trvMenu.CollapseAll();
//TreeNode searchNode = trvMenu.FindNode(selectedNode.Text); // Updated
//TreeNode searchNode = trvMenu.FindNode(selectedNode.Value);
TreeNode searchNode = trvMenu.FindNode(selectedNode.ValuePath);
if (searchNode != null)
searchNode.ExpandAll();
selectedNode.Selected = true;
//selectedNode.Selected = true;
//selectedNode.ExpandAll();
Image: (Updated)
Upvotes: 1
Views: 1306
Reputation: 1447
If I'm correct method FindNode definition is:
public TreeNode FindNode(
string valuePath)
but in your example is trvMenu.FindNode(selectedNode.Text); Just try to put trvMenu.FindNode(selectedNode.ValuePath);
Upvotes: 1