Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

TreeView TreeNodeExpanded

Status
Not open for further replies.

KDavie

Programmer
Feb 10, 2004
441
US
I am using a TreeView control to display some hierarchical data. I want the TreeView to populate its nodes dynamically. I was hoping to achieve this using the TreeNodeExpanded event. Basically, when a node is expanded, the system will fetch the child rows, add them to the hierarchical datasource, and then rebind the data. The hierarchical datasource will be persisted in session state. The problem I am having is, no matter which row I expand, the TreeNodeEventArgs.Node is always the root node. I need a way to figure out which node was expanded. Here is my code:

Code:
protected void tv_TreeNodeExpanded(object sender, TreeNodeEventArgs e)
{
    // No matter what this node is always the root???
    TreeNode node = e.Node;
}

Can anyone tell me how to determine which node was expanded?

Thanks

Kevin Davie
Consultant
Sogeti USA
 
so it turns out I wasn't checking for postback in the form load event... everything works as expected now.

Kevin Davie
Consultant
Sogeti USA
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top