示例#1
0
        void DataBind()
        {
            tv_tjdw.Nodes.Clear();
            MyTreeNode treenode = new MyTreeNode();

            treenode.Text = "体检单位";
            treenode.Str1 = "";
            treenode.Str2 = "";
            treenode.Str3 = "体检单位";

            DataTable dt_tjdw = tjglbiz.Get_TJ_DW();

            if (object.Equals(null, dt_tjdw))
            {
                return;
            }
            for (int i = 0; i < dt_tjdw.Rows.Count; i++)
            {
                MyTreeNode node = new MyTreeNode();
                node.Text = dt_tjdw.Rows[i]["mc"].ToString().Trim();
                node.Str1 = dt_tjdw.Rows[i]["bh"].ToString().Trim();//单位ID
                node.Str2 = "";
                node.Str3 = dt_tjdw.Rows[i]["mc"].ToString().Trim();
                DataTable dt_tj_dwfz_hd = tjglbiz.Get_TJ_DWFZ_HD(node.Str1.Trim());
                foreach (DataRow dr in dt_tj_dwfz_hd.Rows)
                {
                    MyTreeNode node1 = new MyTreeNode();
                    node1.Text = dr["fzmc"].ToString().Trim();
                    node1.Str1 = node.Str1.Trim();           //单位ID
                    node1.Str2 = dr["bh"].ToString().Trim(); //分组ID
                    node1.Str3 = node.Str3.Trim();
                    node.Nodes.Add(node1);
                }

                treenode.Nodes.Add(node);
            }

            tv_tjdw.Nodes.Add(treenode);
            new Common.Common().AddImage(treenode);
        }