这就是
public string tn1;
private void radioButton1_CheckedChanged(object sender, EventArgs e)
{
try
{
TreeNode tn1 = treeView1.Nodes.Add("档案管理系统");
string SQLstr = "SELECT DISTINCT ZZLBID,ZZLBName from ZZLBTable";// where ZZLBName = 1 ";//and sn in(" + all.Substring(0, all.Length - 1).ToString() + ")";
SqlDataAdapter objAdapterNode = new SqlDataAdapter(SQLstr, My_con);
DataSet My_DataSet = new DataSet();
My_DataSet.Clear();
objAdapterNode.Fill(My_DataSet, "temp");
DataTable dt = My_DataSet.Tables["temp"];
tn1.Nodes.Clear();
//建立根节点,遍历。
foreach (DataRow dr in dt.Rows)
{
TreeNode Root = new TreeNode();
Root.Text = dr["ZZLBName"].ToString();
tn1.Nodes.Add(Root);
//TreeView1.Nodes.add(Root);//建立根节点
string str = "SELECT UnitID,ZZClass from ComeFile_Base ";//where UnitID = " + dr["ZZLBID"].ToString() + "' and ComeFile_Base in (" + ZZLBName.Substring(0, ZZLBName.Length - 1).ToString() + ")" + "order by ZZLBID,UnitID";
SqlDataAdapter objAdapter = new SqlDataAdapter(str, My_con);
DataSet dsNode = new DataSet();
dsNode.Clear();
objAdapter.Fill(dsNode, "tempNode");
DataTable dtNode = dsNode.Tables["tempNode"];
//建立子节点,遍历。
foreach (DataRow drNode in dtNode.Rows)
{
TreeNode Node = new TreeNode();
Node.Text = drNode["ZZClass"].ToString();
//Node.Target = "RightFrame";
string Path = drNode["UnitID"].ToString();
//int menusn = Convert.ToInt32(drNode["ZZClass"].ToString());
Node.Name = "Transfer.aspx" + "?ZZClass=" + Path;
Root.Nodes.Add(Node);//建立子节点
}
}
}
catch (Exception edf)
{
MessageBox.Show(" 错误!('您没有可操作的菜单项!'); " + edf.Message);
}
}
private void radioButton2_CheckedChanged(object sender, EventArgs e)
{
try
{
TreeNode tn1 = treeView1.Nodes.Add("档案管理系统");
string SQLstr = "SELECT DISTINCT ZZLBID,ZZLBName from ZZLBTable";// where ZZLBName = 1 ";//and sn in(" + all.Substring(0, all.Length - 1).ToString() + ")";
SqlDataAdapter objAdapterNode = new SqlDataAdapter(SQLstr, My_con);
DataSet My_DataSet = new DataSet();
My_DataSet.Clear();
objAdapterNode.Fill(My_DataSet, "temp");
DataTable dt = My_DataSet.Tables["temp"];
tn1.Nodes.Clear();
//建立根节点,遍历。
foreach (DataRow dr in dt.Rows)
{
TreeNode Root = new TreeNode();
Root.Text = dr["ZZLBName"].ToString();
tn1.Nodes.Add(Root);
//TreeView1.Nodes.add(Root);//建立根节点
string str = "SELECT UnitID,UnitName from ComeFile_Base ";//where UnitID = " + dr["ZZLBID"].ToString() + "' and ComeFile_Base in (" + ZZLBName.Substring(0, ZZLBName.Length - 1).ToString() + ")" + "order by ZZLBID,UnitID";
SqlDataAdapter objAdapter = new SqlDataAdapter(str, My_con);
DataSet dsNode = new DataSet();
dsNode.Clear();
objAdapter.Fill(dsNode, "tempNode");
DataTable dtNode = dsNode.Tables["tempNode"];
//建立子节点,遍历。
foreach (DataRow drNode in dtNode.Rows)
{
TreeNode Node = new TreeNode();
Node.Text = drNode["UnitName"].ToString();
//Node.Target = "mainbottom";
string Path = drNode["UnitID"].ToString();
//int menusn = Convert.ToInt32(drNode["ZZClass"].ToString());
Node.Name = "Transfer.aspx" + "?UnitName=" + Path;
Root.Nodes.Add(Node);//建立子节点
}
}
}
catch (Exception edf)
{
MessageBox.Show(" 错误!('您没有可操作的菜单项!'); " + edf.Message);
}
}