Click here to Skip to main content
15,895,799 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I Have 2 frames. In one frame I have add Tree view control and set its property
XML
<asp:TreeView ID="tvOrg" runat="server"  onclick="fnOnClick()" oncontextmenu="ShowTreeviewContextMenu(this, event);"   PopulateNodesFromClient="true" OnTreeNodePopulate="PopulateNode"   ShowLines="true"  ExpandDepth="0" EnableClientScript="true" HoverNodeStyle-Font-Italic="true" HoverNodeStyle-BackColor="Aqua">
                      </asp:TreeView>



on the another frame I have one textbox and one button. when I click on this button . A new node has added in the left frame. But my problem is when I click on this button 2 new nodes have been added in left frame Because "OnTreeNodePopulate" event called automatically .

Could you please help me on this How can I avoid these duplicate records in treeview.

Its an request, please sort out this issue asap.
Posted

1 solution

Hi,

Can you try to set PopulateOnDemand property for a node is set to false and check if the node is added twice.

// Create the new
TreeNode NewNode = new TreeNode(row["ProductName"].ToString());

// Set the PopulateOnDemand property to false, because these are leaf nodes and
// do not need to be populated.
NewNode.PopulateOnDemand = false;
 
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