private void cmbyuan_SelectedIndexChanged(object sender, EventArgs e) { SpecialityBLL Speciality = new SpecialityBLL(); SpecialityModel model = new SpecialityModel(); model.Speciality_ID = "%" + this.cmbyuan.SelectedValue.ToString() + "%"; cmbzhuan.DisplayMember = "专业名称"; cmbzhuan.ValueMember = "专业编号"; cmbzhuan.DataSource = Speciality.GetIdSpeciality(model); }
/// <summary> /// 树视图二级节点:绑定指定学院下的专业 /// </summary> /// <param name="t">上一级节点</param> void BindSpeciality(TreeNode t) { specmodel.Speciality_ID = "%" + t.Tag.ToString() + "%"; DataTable dt = speciality.GetIdSpeciality(specmodel); foreach (DataRow r in dt.Rows) { TreeNode spec = new TreeNode(); spec.Text = r["专业名称"].ToString(); spec.Tag = r["专业编号"]; spec.ImageIndex = 0; t.Nodes.Add(spec); BindClass(spec);//在该专业下绑定班级节点 } }
private void button5_Click(object sender, EventArgs e) { SpecialityBLL Speciality = new SpecialityBLL(); SpecialityModel model = new SpecialityModel(); model.Speciality_ID = "%" + txtzhuanchaname.Text + "%"; model.Speciality_Name = "%" + txtzhuanchaname.Text + "%"; if (this.cmbchalei.SelectedIndex == 0) { datazhuan.DataSource = Speciality.GetIdSpeciality(model); } else { datazhuan.DataSource = Speciality.GetNameSpeciality(model); } }