473,399 Members | 3,401 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

TreeView SelectedNodeChanged Triggers Parent's TreeNodePopulate?

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!
Aug 4 '08 #1
1 4951
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);
}
Aug 4 '08 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Andrew Robinson | last post by:
I am using a TreeView to perform navigation and have a few nodes that need to generate a popup menu. For this, I use the SelectedNodeChanged event and then add the relevant "window.open" script to...
2
by: Eamon Millman | last post by:
Greetings, I'm fairly new to the new ASP.NET 2.0 controls and I'm trying to get the TreeView control to display some non-xml/sitemap data I want to have in a tree format. To accomplish this...
1
by: bill | last post by:
When PopulateOnDemand is true, the treeview event handler for the TreeNodePopulate event gets the TreeNodeEventArgs as a parameter. The TreeNodeEventArgs contains the tree node to be populated,...
3
by: Shawn | last post by:
Hi. I'm working with the TreeView control in my ASP.NET 1.1 application. I have a problem I haven't been able to figure out. When I click on a node (not expand), whether it's a parent node, a...
6
by: cyriel1920 | last post by:
Hi, I use the selectednodestyle with a white background so the user can see which item was chosen in the treeview navigation. The nodes have a navigateURL with a target to another frame....
1
by: tanya foster | last post by:
Hello, I have populated a treeview in asp.net 2.0 from an xmldocument. The treeview structure in the asp web page looks something like... -orderdata -order -lines -operations -materials...
0
by: Rick | last post by:
Hi guys, i have a problem with treeview, i have a master page and a treeview as my site menu, 1 root, 5 parents and each parent has 10 leafs, when i press a leaf the SelectedNodeChanged treeview...
1
by: aaronh64 | last post by:
I'm trying to bind to the ASP.NET TreeView control and utilize the PopulateOnDemand functionality. However, I am receiving the following (very confusing) error: "PopulateOnDemand only supported...
2
by: =?Utf-8?B?anAybXNmdA==?= | last post by:
My first time using a TreeView: I've got a TreeView that I populated with some data and it has nodes. In the Properties window, I created an Event Handler for the TreeView's AfterSelect...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.