码迷,mamicode.com
首页 > 其他好文 > 详细

一次加载一层tree

时间:2015-01-12 19:08:26      阅读:112      评论:0      收藏:0      [点我收藏+]

标签:

public void LoadRoot()
{
trv.AfterSelect += new TreeViewEventHandler(trv_AfterSelect);
trv.Nodes.Clear();
string sql = "select NODE,NODE_NAME,PARENT_NODE from NODE_TREE where PARENT_NODE=‘1‘ order by NODE asc";
DataTable dt = DALOpers.GetTable(OracleHelper.sqlType, OracleHelper.connStrOrcl, sql);
foreach (DataRow dr in dt.Rows)
{
TreeNode node = new TreeNode();
node.Text = dr["NODE_NAME"].ToString();
node.Tag = dr["NODE"].ToString();
trv.Nodes.Add(node);
}
}

 

 

private void trv_AfterSelect(object sender, TreeViewEventArgs e)
{
TreeNode tn = e.Node as TreeNode;
if (tn.Nodes.Count > 0)
{
return;
}
string tag = e.Node.Tag.ToString();
string sql = "select NODE,NODE_NAME,PARENT_NODE from NODE_TREE where PARENT_NODE=‘" + tag + "‘ order by node";
DataTable dt = DALOpers.GetTable(OracleHelper.sqlType, OracleHelper.connStrOrcl, sql);
foreach (DataRow dr in dt.Rows)
{
TreeNode node = new TreeNode();
node.Text = dr["NODE_NAME"].ToString();
node.Tag = dr["NODE"].ToString();
e.Node.Nodes.Add(node);
}
LoadDMG(tag);
jieDianID = e.Node.Tag.ToString();
}

一次加载一层tree

标签:

原文地址:http://www.cnblogs.com/lemeng/p/4218920.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!