private void DataGridDanhSachMonHoc_SelectionChanged(object sender, SelectionChangedEventArgs e) { try { db = new MyDbContext(); var obj = dataGridDanhSachMonHoc.SelectedItem; monHoc = db.MonHoc.Find((obj as MonHoc).MaMonHoc); if (obj != null) { MonHoc monHoc = (MonHoc)obj; LopDAO dao = new LopDAO(); List <Lop> lops = dao.GetLops(monHoc.MaMonHoc); dataGridDanhSachLop.ItemsSource = lops; } }catch (Exception ex) { } }