private void gridViewMain_MasterRowEmpty(object sender, DevExpress.XtraGrid.Views.Grid.MasterRowEmptyEventArgs e) { // neu loai quyen khong co quyen thi dau cong khong xuat hien GridView view = sender as GridView; LoaiQuyen loaiQuyen = view.GetRow(e.RowHandle) as LoaiQuyen; if (loaiQuyen != null) { e.IsEmpty = !quyens.Any(x => x.LoaiQuyenId == loaiQuyen.LoaiQuyenId); } }
private void gridViewMain_MasterRowGetChildList(object sender, DevExpress.XtraGrid.Views.Grid.MasterRowGetChildListEventArgs e) { // load data đen grid detail GridView view = sender as GridView; LoaiQuyen loaiQuyen = view.GetRow(e.RowHandle) as LoaiQuyen; List <Quyen> quyensTheoMa = new List <Quyen>(); if (loaiQuyen != null) { if (comboBoxChucVu.SelectedItem != null) { List <string> maQuyenTheoChucVu = (comboBoxChucVu.SelectedItem as ComboBoxItemPhanQuyen).ChucVu.MaQuyens; foreach (Quyen quyen in quyens) { if (quyen.LoaiQuyenId == loaiQuyen.LoaiQuyenId) { quyensTheoMa.Add(quyen); } } quyensTheoMa.ForEach((quyen) => { if (maQuyenTheoChucVu.Contains(quyen.QuyenId)) { quyen.Check = true; } else { quyen.Check = false; } }); } e.ChildList = quyensTheoMa; } }