我爱Aspx >> Asp.Net >> ASP.NET中使用Treeview和XML以上是在设计时,静态添加数据到树形控件的方法。而由于XML实质上也是以树形结构来表示数据的结构,因此,就可以通过使用XML文件绑定到树形控件的方法,来动态加载数据到控件中去,其中有两种方法可以实现:
1)另外写一个符合TREEVIEW格式的XML文件
2)通过XSL将XML进行转换。
先来看下第一种方法,建一个XML文件作为例子,命名为aspnetbooks.xml:
| <?xml version="1.0" encoding="UTF-8"?><books> <book price="34.95"> <title>Teach Yourself Active Server Pages 3.0 in 21 Days</title> <authors> <author>Mitchell</author> <author>Atkinson</author> </authors> <year>1999</year> </book><book price="29.95"><title>Designing Active Server Pages</title><authors> <author>Mitchell</author></authors> <year>2000</year></book><book price="34.95"><title>ASP.NET: Tips, Tutorials, and Code</title><authors> <author>Mitchell</author> <author>Mack</author> <author>Walther</author> <author>Seven</author> <author>Anders</author> <author>Nathan</author> <author>Wahlin</author></authors><year>2001</year></book><book price="24.95"><title>ASP Unleashed</title><authors> <author>Walther</author> </authors><year>1998</year></book></books> |
ASP.NET中的HTTP模块和处理程序[05-20]
ASP.NET中的HTTP模块和处理程序[05-20]
在ASP.NET中使用用户控件[05-20]
五种常见的ASP.NET安全缺陷[05-20]
ASP.NET中实现模版的动态加载[05-20]
ASP.NET创建并使用Web组件[05-20]
ASP.NET开发员工业绩评测中心[05-20]
用ASP.NET创建自定义文本框[05-20]
NT及低配置老机上用ASP.net的体会..[05-20]
NT及低配置老机上用ASP.net的体会..[05-20]
ASP.NET中的HTTP模块和处理程序[05-20]
ASP.NET中的HTTP模块和处理程序[05-20]
在ASP.NET中使用用户控件[05-20]
五种常见的ASP.NET安全缺陷[05-20]
ASP.NET中实现模版的动态加载[05-20]
ASP.NET创建并使用Web组件[05-20]
ASP.NET开发员工业绩评测中心[05-20]
用ASP.NET创建自定义文本框[05-20]
NT及低配置老机上用ASP.net的体会..[05-20]
NT及低配置老机上用ASP.net的体会..[05-20]