protected void RadTreeViewNhomQuyen_Nodeclick(object sender, RadTreeNodeEventArgs e) { Int32 idNhomQuyen = Int32.Parse(RadTreeViewNhomQuyen.SelectedNode.Value); Int32 idChucNang = Int32.Parse(RadTreeViewChucNang.SelectedNode.Value); LoadQuyen(idNhomQuyen, idChucNang); GridUserQuyen.Rebind(); Session["nhomQuyen"] = RadTreeViewNhomQuyen.SelectedNode.Value; if (GridUserQuyen.Items.Count > 0) { GridUserQuyen.Items[0].Selected = true; GridDataItem item = GridUserQuyen.Items[0]; Session["idNvPq"] = Int32.Parse(item["IDNhanVien"].Text); } }
protected void AjaxManager_Request(object sender, AjaxRequestEventArgs e) { switch (e.Argument) { case "removeUser": Int32 idNV = (Int32)Session["idNvPq"]; Int32 nhomQuyen = Int32.Parse(Session["nhomQuyen"].ToString()); var dt = _entities.NhanVien_NhomQuyen.Where(x => x.IDNhanVien == idNV && x.IDNhomQuyen == nhomQuyen).First(); _entities.NhanVien_NhomQuyen.DeleteObject(dt); _entities.SaveChanges(); GridUserQuyen.Rebind(); break; case "RebindGrid": GridUserQuyen.Rebind(); var dsNhom = _entities.NhomQuyens; RadTreeViewNhomQuyen.DataSource = dsNhom; RadTreeViewNhomQuyen.DataBind(); break; default: break; } }