/// <summary> /// 根据专业ID绑定班级 /// </summary> /// <param name="specid"></param> void BinderClasses(string specid) { islock = true; DataTable Speciality = TreeViewBLL.GetClassesBLL(specid); this.cmbBoxClass.DataSource = Speciality; this.cmbBoxClass.DisplayMember = "Classes_Name"; this.cmbBoxClass.ValueMember = "Classes_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("异常!"); } }