private void dataGridViewGroups_CellClick(object sender, DataGridViewCellEventArgs e) { DataTable dtGroupStudents = GroupDAL.GetGroupStudents( (int)dataGridViewGroups.Rows[dataGridViewGroups.SelectedCells[0].RowIndex].Cells["Group ID"].Value); this.dataGridViewGroupStudents.DataSource = dtGroupStudents; }
private void TeacherStudyGroups_Load(object sender, EventArgs e) { DataTable dtGroups = TeacherDAL.GetTeacherGroups(TeacherID);//TeacherDAL.GetTeacherStudents(TeacherID); this.dataGridViewGroups.DataSource = dtGroups; foreach (DataGridViewColumn dc in dataGridViewGroups.Columns) { if (dc.Name != "Description") { dc.ReadOnly = true; } } this.dataGridViewGroups.Update(); //bind binging navigator to data grid var bs = new BindingSource(); bs.DataSource = dtGroups.DefaultView; bindingNavigator1.BindingSource = bs; dataGridViewGroups.DataSource = bs; DataTable dtGroupStudents = GroupDAL.GetGroupStudents((int)dataGridViewGroups.Rows[dataGridViewGroups.SelectedCells[0].RowIndex].Cells["Group ID"].Value); this.dataGridViewGroupStudents.DataSource = dtGroupStudents; toolStripTeacherID.Text = "Teacher ID: " + TeacherID.ToString(); }