Beispiel #1
0
        private void rptRoles_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            Role role = e.Item.DataItem as Role;

            if (role != null)
            {
                CheckBox chkView = (CheckBox)e.Item.FindControl("chkViewAllowed");
                chkView.Checked = ActiveNode.ViewAllowed(role);
                CheckBox chkEdit = (CheckBox)e.Item.FindControl("chkEditAllowed");
                if (role.HasPermission(AccessLevel.Editor) || role.HasPermission(AccessLevel.Administrator))
                {
                    chkEdit.Checked = ActiveNode.EditAllowed(role);
                }
                else
                {
                    chkEdit.Visible = false;
                }
                // Add RoleId to the ViewState with the ClientID of the repeateritem as key.
                ViewState[e.Item.ClientID] = role.Id;
            }
        }