Click here to Skip to main content
15,903,175 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
i have populated a tree view dynamically from data base.suppose i have parent nodes A, B, C and Child nodes a, b, c which would be same for three of the parent nodes.now when a user click on a child node 'a' it should open a page related to it and if a user click on 'b' then it should open its respective page and same for the c child node.how can i do this plz help me as soon as possible.
thanking in advanced.
Posted

use SelectedNodeChanged event of the treeView control
and type cast as following and get selected node as

TreeView tv = (TreeView)sender;
tv.SelectedNode.Text


and redirect which ever page u want
 
Share this answer
 
When you are populating tree form database add node like below code:

TreeNode Childnode = new TreeNode();
Childnode.Text = childname;-- name of node
Childnode.NavigateUrl = drparname["Mnu_PageName"].ToString();-- url of the page
Childnode.Value = drparname["Mnu_Pkey"].ToString();-- key value for the menu node
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900