treeview的节点的展开和收缩
public void Expandnodes(Microsoft.Web.UI.WebControls.TreeNode node,bool Expand)
{
foreach(Microsoft.Web.UI.WebControls.TreeNode n in node.Nodes)
{
if(n.Nodes.Count>0)
{
n.Expanded = Expand;
Expandnodes(n, Expand);
}
}
}
public void Expandnodes(Microsoft.Web.UI.WebControls.TreeView treeview, bool Expand)
{
foreach(Microsoft.Web.UI.WebControls.TreeNode n in treeview.Nodes)
{
if(n.Nodes.Count>0)
{
n.Expanded = Expand;
Expandnodes(n, Expand);
}
}
}
Expandnodes(Me.TreeView1, true)展开全部节点,Expandnodes(Me.TreeView1, false)折叠全部节点