简体   繁体   English

如何在ASP.NET中生成树视图?

[英]How to generate a treeview in ASP.NET?

  1. How to generate a tree view in asp.net? 如何在asp.net中生成树视图?
  2. In my asp.net project i need a tree view like structure, the format given below alt text http://dev1.ispg.in/dg/untitled.bmp 在我的asp.net项目中,我需要一个类似结构的树形视图,格式如下: alt文本http://dev1.ispg.in/dg/untitled.bmp

ASP.NET does have a TreeView control that you can use to display a Treeview very similar to the one you show. ASP.NET确实具有一个TreeView控件 ,可用于显示与您所显示的非常相似的Treeview。

If you require the Checkboxes on each and every Treeview node, but sure to set the ShowCheckBoxes attribute to the appropriate setting (ie ShowCheckBoxes="All" > 如果您在每个Treeview节点上都需要Checkboxes ,但是请确保将ShowCheckBoxes属性设置为适当的设置(即ShowCheckBoxes="All" >

Regarding the nodes themselves, you can bind the TreeView to a DataSource which can either be an ASP.NET SiteMap file or an XML Document. 关于节点本身,可以将TreeView绑定到DataSource ,该DataSource可以是ASP.NET SiteMap文件或XML文档。 Alternatively, you can programmatically add the nodes yourself in code like so: 另外,您可以自己以编程方式在代码中添加节点,如下所示:

TreeNode tn = new TreeNode();
tn.Value = "Cities";
TreeView1.Nodes.Add(tn);
tn.ChildNodes.Add(new TreeNode("Cochin 1"));
[etc. etc.]  

Some other useful links are: 其他一些有用的链接是:

Using the TreeView Control and a DataList to Create an Online Image Gallery 使用TreeView控件和DataList创建在线图像库
ASP.NET Treeview Quickstart Tutorial ASP.NET Treeview快速入门教程

使用asp.net treeview,看看这里一切都解释了

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM