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();
}