private void InitTree(TreeNode node, int pid)
{
for (int i = 0; i < dt1.Rows.Count; i++)
{
if (Convert.ToInt32(dt1.Rows[i]["pid"].ToString()) == pid)
{
TreeNode newNode = new TreeNode(dt1.Rows[i]["name"].ToString());
node.Nodes.Add(newNode);
InitTree(newNode, Convert.ToInt32(dt1.Rows[i]["id"].ToString()));
}
}
时间: 2024-11-05 18:46:19