- 如何在asp.net中生成 TreeView ?
- 在我的 asp.net 项目中,我需要一个类似 TreeView 的结构,格式如下 alt text http://dev1.ispg.in/dg/untitled.bmp
最佳答案
ASP.NET 确实有 TreeView
control您可以使用它来显示与您所显示的非常相似的 TreeView 。
如果您需要在每个 Treeview 节点上使用 Checkboxes
,但请确保将 ShowCheckBoxes
属性设置为适当的设置(即 ShowCheckBoxes="All"
>
关于节点本身,您可以将 TreeView
绑定(bind)到 DataSource
,它可以是 ASP.NET SiteMap
file或 XML 文档。或者,您可以以编程方式自己在代码中添加节点,如下所示:
TreeNode tn = new TreeNode();
tn.Value = "Cities";
TreeView1.Nodes.Add(tn);
tn.ChildNodes.Add(new TreeNode("Cochin 1"));
[etc. etc.]
其他一些有用的链接是:
Using the TreeView Control and a DataList to Create an Online Image Gallery
ASP.NET Treeview Quickstart Tutorial
关于c# - 如何在 ASP.NET 中生成 TreeView ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3404659/