Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > TreeView SelectedNodeChanged Triggers Parent's TreeNodePopulate?

Reply
Thread Tools

TreeView SelectedNodeChanged Triggers Parent's TreeNodePopulate?

 
 
dmeglio@gmail.com
Guest
Posts: n/a
 
      08-04-2008
I have a treeview control. The "root" elements and the 2nd level
elements are set to PopulateOnDemand. All is fine, my TreeNodePopulate
triggers and works. When you click one of those nodes, I load ALL the
data under it. Meaning children, grandchildren, great grandchildren,
etc. Hence, those 3rd level and below nodes are
PopulateOnDemand=false. At the 3rd level, my nodes are set to
SelectAction = SelectExpand. When I click on one of them, my
SelectedNodeChanged event does fire, but AFTER the TreeNodePopulate
fires for the 2nd level node. My question is, why is it loading data
for a node I didn't even click (the parent of the node I clicked), and
why is it loading it given that the data is already loaded?

Is this a bug? Is there a work around? Thank you in advance!
 
Reply With Quote
 
 
 
 
dmeglio@gmail.com
Guest
Posts: n/a
 
      08-04-2008
Sorry I didn't post this at first, but the following code reproduces
it:
In aspx:
<asp:TreeView
id="TreeView1"
runat="server"
ExpandDepth="0"
ShowLines="true"
PopulateNodesFromClient="true"
OnTreeNodePopulate="TreeView1_TreeNodePopulate">
</asp:TreeView>
In codebehind:
protected void Page_Load(object sender, EventArgs e)
{
TreeNode node = new TreeNode();
node.Text = "test1";
node.PopulateOnDemand=true;
TreeView1.Nodes.Add(node);
}

protected void TreeView1_TreeNodePopulate(object sender,
TreeNodeEventArgs e)
{
TreeNode node = new TreeNode();
node.SelectAction = TreeNodeSelectAction.SelectExpand;
node.Text = "test2";
e.Node.ChildNodes.Add(node);
}
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
TreeView SelectedNodeChanged event Velislav ASP .Net 0 11-24-2006 11:27 AM
SelectedNode is not correct in SelectedNodeChanged event stacy@sensorswitch.com ASP .Net 0 09-19-2006 07:43 PM
Masterpage Treeview SelectedNodeChanged and Style errors biker ASP .Net Web Controls 0 08-03-2006 04:33 PM
selectednodechanged event on .NET 2.0 treeview problem tanya foster ASP .Net 1 06-05-2006 12:38 PM
TreeView SelectedNodeChanged Event Andrew Robinson ASP .Net 4 12-07-2005 02:35 AM



Advertisments