从树视图控件中删除根 [英] to remove root from tree view controls

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

问题描述

每个人都


我从toolbox.its放置树状视图,就像
+根
+ parent1
+ leaf1
+ leaf2
+ parent2
+ leaf1
+ leaf2

我想从树形视图中删除根

+ parent1
+ leaf1
+ leaf2
+ parent2
+ leaf1
+ leaf2

如果我通过数据库绑定树视图

,怎么可能

感谢advance

hai every one


i place tree view from toolbox.its like
+Root
+parent1
+leaf1
+leaf2
+parent2
+leaf1
+leaf2

i want to remove root from tree view

+parent1
+leaf1
+leaf2
+parent2
+leaf1
+leaf2

If i binding the tree view through database

,how it possible

thanks advance

推荐答案

以类似于以下内容的标记开始:

Start with mark-up similar to the following:

<asp:treeview xmlns:asp="#unknown">
    ID="tvRPM"
    runat="server"
    EnableClientScript="true"
    ExpandDepth="0"
    PopulateNodesFromClient="true"
    ShowLines="true"
    OnTreeNodePopulate="PopulateNode"/>
</asp:treeview>



然后,您将通过OnLoad事件填充父级,并从您附加到OnTreeNodePopulate事件的事件填充子级:在上述情况下,我调用了我的方法,而不是想象中的"PopulateNode".它具有以下签名:



You would then populate the parent from the OnLoad event and populate children from the event you attach to the OnTreeNodePopulate event: in the case above I have called my method, rather unimaginatively, ''PopulateNode''. It has this signature:

protected void PopulateNode(Object sender, TreeNodeEventArgs e)
{
	// Code to populate the child nodes...
}



这应该可以帮助您入门:您需要做一些进一步的研究,但这应该很有趣.



That should get you started: you''ll need to do some further research but that should be fun.


这篇关于从树视图控件中删除根的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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