protected void Page_Init(object sender, EventArgs e) { if (allRoles.Count() == 0) { allRoles = RolesMapper.RemoveRoles(RolesMapper.GetAll(), rolesToRemove); } Bind(); }
private void BindRolesList() { var roles = RolesMapper.GetAll().ToList(); if (!CurrentUser.IsInRole(RoleEnum.Developer)) { roles = roles.Where(i => i != RolesMapper.GetByEnum(RoleEnum.Developer)).ToList(); } RolesList.DataSource = roles; RolesList.DataTextField = "Name"; RolesList.DataValueField = "ID"; RolesList.DataBind(); }