Asp.net Treeview控件 [英] Asp.net Treeview Control
本文介绍了Asp.net Treeview控件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有2帧。在一个框架中,我添加了树视图控件并设置其属性
I Have 2 frames. In one frame I have add Tree view control and set its property
<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>
另一帧我有一个文本框和一个按钮。当我点击这个按钮。左侧框架中添加了一个新节点。但我的问题是,当我点击此按钮时,左框架中添加了2个新节点因为OnTreeNodePopulate事件自动调用。
你能帮我解决这个问题。如何在树视图中避免这些重复记录。
请求,请尽快解决这个问题。
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.
推荐答案
您是否可以尝试将节点的PopulateOnDemand属性设置为false并检查节点是否添加了两次。
//创建新的
TreeNode NewNode = new TreeNode(row [ProductName]。ToString());
//将PopulateOnDemand属性设置为false,因为这些是叶节点,并且不需要填充
//
NewNode。 PopulateOnDemand = false;
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;
这篇关于Asp.net Treeview控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文