以编程方式删除树视图的节点 [英] programmatically delete nodes of a treeview

查看:65
本文介绍了以编程方式删除树视图的节点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好



在我的ASP.Net应用程序中,我正在从数据库绑定树视图。此外,我已经完成编码,通过单击树节点将子元素保存到DB。现在我想知道从树视图和数据库中删除节点的代码?

Hi all

In my ASP.Net application i'm binding a treeview from database. Also i have done coding to save child elements to DB by clicking on a tree node. Now i want to know the code for deleting nodes from the tree view as well as in the DB ?

treeView1.Nodes.Remove(treeView1.SelectedNode);

通过使用此我可以从树视图中删除节点而不是从DB中删除节点,因此当我刷新页面时,已删除的节点再次显示。

by using this i can remove nodes from tree view but not from DB , so when i refresh the page deleted nodes again displayed.

推荐答案

删除节点时,删除表中的行,以便下次节点不刷新值。
When you remove the node, delete the row in the table so next time node does not refresh with the value.


阅读MSDN文档有什么问题?这里:

http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.treeview.nodes%28v=vs.110%29.aspx [ ^ ],

http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.treenodecollection%28v=vs.110%29.aspx [<一个href =http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.treenodecollection%28v=vs.110%29.aspxtarget =_ blanktitle =New Window > ^ ],

http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.treenodecollection.remove%28 v = vs.110%29.aspx [ ^ ],

http://msdn.microsoft.com/en-us/library/system.web.ui。 webcontrols.treenodecollection.removeat%28v = vs.110%29.aspx [ ^ ],

Microsoft Q209354



最重要的链接这当然是最后一个。



-SA
What's wrong with just reading the MSDN documentation? Here:
http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.treeview.nodes%28v=vs.110%29.aspx[^],
http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.treenodecollection%28v=vs.110%29.aspx[^],
http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.treenodecollection.remove%28v=vs.110%29.aspx[^],
http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.treenodecollection.removeat%28v=vs.110%29.aspx[^],
Microsoft Q209354.

The most important link here is, of course, the last one.

—SA


这篇关于以编程方式删除树视图的节点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆