void creatertree(TreeNode node)
{
if (ds_area.Tables.Count > 0)
{
foreach (DataRow dr in ds_area.Tables["trade_areacode"].Rows)
{
if (dr["Parentcode"].ToString() == node.Value.ToString())
{
//主节点
TreeNode tn = new TreeNode();
tn.Text = dr["areaname"].ToString();
tn.Value = dr["areacode"].ToString();
tn.ShowCheckBox = true;
tn.Checked = true;
node.ChildNodes.Add(tn);
creatertree(tn);
}
}
}
}
protected void TreeView3_TreeNodePopulate(object sender, TreeNodeEventArgs e)
{
creatertree(e.Node);
}
{
if (ds_area.Tables.Count > 0)
{
foreach (DataRow dr in ds_area.Tables["trade_areacode"].Rows)
{
if (dr["Parentcode"].ToString() == node.Value.ToString())
{
//主节点
TreeNode tn = new TreeNode();
tn.Text = dr["areaname"].ToString();
tn.Value = dr["areacode"].ToString();
tn.ShowCheckBox = true;
tn.Checked = true;
node.ChildNodes.Add(tn);
creatertree(tn);
}
}
}
}
protected void TreeView3_TreeNodePopulate(object sender, TreeNodeEventArgs e)
{
creatertree(e.Node);
}