void BinderColleges() { islock = true; DataTable colleges = TreeViewBLL.GetCollegesBLL(); this.cmbBoxCollege.DataSource = colleges; this.cmbBoxCollege.DisplayMember = "College_Name"; this.cmbBoxCollege.ValueMember = "College_ID"; islock = false; }
void bindTreeView() { try { DataTable colleges = TreeViewBLL.GetCollegesBLL(); tvColleges.Nodes.Clear(); foreach (DataRow row in colleges.Rows) { TreeNode tn = new TreeNode(row["College_Name"].ToString()); tn.Name = row["College_ID"].ToString(); tn.Tag = "colleges"; tvColleges.Nodes.Add(tn); DataTable speciality = TreeViewBLL.GetSpecBLL(row["College_ID"].ToString()); foreach (DataRow specrow in speciality.Rows) { TreeNode spec = new TreeNode(specrow["Speciality_Name"].ToString()); spec.Name = specrow["Speciality_ID"].ToString(); spec.Tag = "Speciality"; tn.Nodes.Add(spec); DataTable classes = TreeViewBLL.GetClassesBLL(specrow["Speciality_ID"].ToString()); foreach (DataRow classrow in classes.Rows) { TreeNode classe = new TreeNode(classrow["Classes_Name"].ToString()); classe.Name = classrow["Classes_ID"].ToString(); classe.Tag = "Classes"; spec.Nodes.Add(classe); } } } } catch (Exception) { MessageBox.Show("异常!"); } }