private void comboBoxEdit_Send_StuGrade_SelectedIndexChanged(object sender, System.EventArgs e) { comboBoxEdit_Send_StuClass.Properties.Items.Clear(); comboBoxEdit_Send_StuClass.Properties.Items.AddRange(new object[] { "全部" }); comboBoxEdit_Send_StuClass.SelectedItem = "全部"; if (getStuInfoByCondition.getGradeInfo(comboBoxEdit_Send_StuGrade.SelectedItem.ToString(), "").Tables[0].Rows.Count > 0) { //根据年级选择获取年级编号 getGradeNumberFromCombo = getStuInfoByCondition.getGradeInfo( comboBoxEdit_Send_StuGrade.SelectedItem.ToString(), "").Tables[0].Rows[0][0].ToString(); foreach (DataRow getClassList in getStuInfoByCondition.getClassInfo("", "", getGradeNumberFromCombo).Tables[0].Rows) { comboBoxEdit_Send_StuClass.Properties.Items.AddRange( new object[] { getClassList[1].ToString() }); } } //根据年级查询所选信息 if (!comboBoxEdit_Send_StuGrade.SelectedItem.ToString().Equals("全部")) { SelectPhoneInfo(textEdit_Send_StuName.Text.Trim(), textEdit_Send_StuNumber.Text.Trim(), comboBoxEdit_Send_StuGrade.SelectedItem.ToString().Trim(), comboBoxEdit_Send_StuClass .SelectedItem.ToString().Trim()); } else { SelectPhoneInfo(textEdit_Send_StuName.Text.Trim(), textEdit_Send_StuNumber.Text.Trim(), string.Empty, comboBoxEdit_Send_StuClass.SelectedItem.ToString().Trim()); } }
private void repositoryItemComboBox1_SelectedIndexChanged(object sender, System.EventArgs e) { int i = gridView1.GetSelectedRows()[0]; repositoryItemComboBox2.Items.Clear(); DevExpress.XtraEditors.ComboBoxEdit cbeGrade = (DevExpress.XtraEditors.ComboBoxEdit)sender; string grade = cbeGrade.SelectedItem.ToString(); if (grade.Length != 0 && !grade.Equals("不选择")) { repositoryItemComboBox2.Items.Add("不选择"); GetStuInfoByCondition getStuInfoByCondition = new GetStuInfoByCondition(); string getGradeNumberFromCombo = getStuInfoByCondition.getGradeInfo( grade, "").Tables[0].Rows[0][0].ToString(); foreach (DataRow getClassList in getStuInfoByCondition.getClassInfo("", "", getGradeNumberFromCombo).Tables[0].Rows) { repositoryItemComboBox2.Items.AddRange( new object[] { getClassList[1].ToString() }); } } else { if (grade.Equals("不选择")) { repositoryItemComboBox2.Items.Clear(); repositoryItemComboBox2.Items.Add("不选择"); } } gridView1.SetRowCellValue(i, gridView1.Columns["指定班级"], null); gridView1.SetRowCellValue(i, gridView1.Columns["指定年级"], grade); }