I have implemented treeview control in my web page. I have written the following code to select a particular treeitem(node):
private bool SelectNode(TreeView TreeView)
{
Int32 i = 0;
Int32 SelectedNode = Convert.ToInt32(Request.QueryString["ID"]);
foreach (TreeNode node in TreeView.Nodes)
{
if (SelectedNode == Convert.ToInt32(node.Value))
{
TreeView.Nodes[i].Selected = true;
}
i++;
}
return true;
}
The Convert.ToInt32(Request.QueryString["ID"]) this statement determine the value of the node. But this statement only the nodes in the root lavel. But there can be n-number of lavels. How can I select the nodes under the root level or any level.
Any idea. Any help will be thankfully received.
Partha