Click here to Skip to main content
15,867,488 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
I am binding the treeview control based on the xml (it contains multilevel. Treeview with check boxes. Now i need to bind the Gridview control based on the selection of Treview nodes(parent, child nodes). I request can you any body help me on the below issues.

1. How to bind the Gridview based on selection of Treeview
2. How to get the Treview node values and path of the nodes.

Thanks
Mahesh.
Posted

Add a TreeNodeCheckChanged Event Handler to TreeView control and on PostBack you will get the selected node value and full path as follows:

C#
protected void TreeView1_TreeNodeCheckChanged(object sender, TreeNodeEventArgs e)
{
        string nodePath = e.Node.ValuePath;
        string nodeValue = e.Node.Value;
}


Based on the nodeValue selection (Or, nodePath selection) you retrieve data from the database and populate in the GridView.

You can see a number of examples of TreeView here : http://quickstarts.asp.net/QuickStartv20/aspnet/doc/ctrlref/navigation/treeview.aspx[^]
 
Share this answer
 
v3
Try the link below:
Link-1[^]
 
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