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);
    }
posted on 2008-01-18 14:29  微星  阅读(401)  评论(0编辑  收藏  举报