第一棵:使用AJAX 按需求建立一棵树 Building Tree View on demand using AJAX
http://www.cnblogs.com/OceanChen/archive/2009/02/07/1385664.html
这篇文章简单告诉我们如何使用AJAX异步生成树,且数据源为XML,看看截图,是不是很酷 当然你还可以在链接上下载源代码!
文章出去: http://www.codeproject.com/KB/aspnet/TreeViewAjax.aspx
第二棵:用使用JavaScript展开/折叠TreeView中所有节点(Expand and Collapse All Nodes of asp.net Treeview on the client with javascript)
http://www.cnblogs.com/OceanChen/archive/2009/02/07/1385662.html
这是我给客户的一个解决方案,为了节约时间,我直接贴可以跑到代码,同时没有写注释,希望谅解,
Code
<%@ Page Language="C#" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title>TreeView Demo</title>
<script language="javascript" type="text/javascript">
function TreeviewExpandCollapseAll(treeViewId, expandAll) {
var displayState = (expandAll == true "none" : "block");
var treeView = document.getElementById(treeViewId);
if (treeView) {
var treeLinks = treeView.getElementsByTagName("a");
var nodeCount = treeLinks.length;
for (i = 0; i < nodeCount; i++) {
if (treeLinks[i].firstChild.tagName) {
if (treeLinks[i].firstChild.tagName.toLowerCase() == "img