protected void t(string path)
{
TreeNode htn = new TreeNode();
htn.Text=path;
htn.Expanded = false;
htn.SelectAction = TreeNodeSelectAction.Select;
tree.Nodes.Add(htn);
zinode(htn);
}
protected void zinode(TreeNode tn)
{
string[] direc;
direc = Directory.GetDirectories(tn.Text);
for (int i = 0; i < direc.Length; i++)
{
TreeNode ctn = new TreeNode();
ctn.Text = direc[i];
ctn.Value = i.ToString();
ctn.Expanded = false;
ctn.SelectAction = TreeNodeSelectAction.Select;
tn.ChildNodes.Add(ctn);
string[] direct = Directory.GetDirectories(ctn.Text);//判断是否有子目录
if (direct.Length > 0)// 有 递归调用,列出下级
zinode(ctn); //文件及目录
}
}
{
TreeNode htn = new TreeNode();
htn.Text=path;
htn.Expanded = false;
htn.SelectAction = TreeNodeSelectAction.Select;
tree.Nodes.Add(htn);
zinode(htn);
}
protected void zinode(TreeNode tn)
{
string[] direc;
direc = Directory.GetDirectories(tn.Text);
for (int i = 0; i < direc.Length; i++)
{
TreeNode ctn = new TreeNode();
ctn.Text = direc[i];
ctn.Value = i.ToString();
ctn.Expanded = false;
ctn.SelectAction = TreeNodeSelectAction.Select;
tn.ChildNodes.Add(ctn);
string[] direct = Directory.GetDirectories(ctn.Text);//判断是否有子目录
if (direct.Length > 0)// 有 递归调用,列出下级
zinode(ctn); //文件及目录
}
}