Click here to Skip to main content
15,891,513 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hai every one


i place tree view from toolbox.its like
+Root
+parent1
+leaf1
+leaf2
+parent2
+leaf1
+leaf2

i want to remove root from tree view

+parent1
+leaf1
+leaf2
+parent2
+leaf1
+leaf2

If i binding the tree view through database

,how it possible

thanks advance
Posted

1 solution

Start with mark-up similar to the following:

<asp:treeview xmlns:asp="#unknown">
    ID="tvRPM"
    runat="server"
    EnableClientScript="true"
    ExpandDepth="0"
    PopulateNodesFromClient="true"
    ShowLines="true"
    OnTreeNodePopulate="PopulateNode"/>
</asp:treeview>


You would then populate the parent from the OnLoad event and populate children from the event you attach to the OnTreeNodePopulate event: in the case above I have called my method, rather unimaginatively, 'PopulateNode'. It has this signature:

protected void PopulateNode(Object sender, TreeNodeEventArgs e)
{
	// Code to populate the child nodes...
}


That should get you started: you'll need to do some further research but that should be fun.
 
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