Exemple #1
0
 public static void CargarChekBoxList <T>(ref Anthem.CheckBoxList ChekBox, List <T> Lista, string Valor, string Texto)
 {
     ChekBox.DataSource     = Lista;
     ChekBox.DataTextField  = Texto;
     ChekBox.DataValueField = Valor;
     ChekBox.DataBind();
 }
Exemple #2
0
        private void SetupCheckBoxes(Anthem.CheckBoxList list)
        {
            // Setup the checkboxes so that full-control takes over the others,
            // and there cannot be an action that is both granted and denied
            // The list parameter determines the last checkbox list that changed status,
            // allowing to switch the proper checkbox pair
            if (lstActionsGrant.Items.Count > 0)
            {
                if (list == null)
                {
                    list = lstActionsGrant;
                }
                Anthem.CheckBoxList other = list == lstActionsGrant ? lstActionsDeny : lstActionsGrant;

                // Verify whether full-control is checked
                // If so, disable all other checkboxes
                for (int i = 1; i < list.Items.Count; i++)
                {
                    if (list.Items[0].Selected)
                    {
                        list.Items[i].Selected = false;
                        list.Items[i].Enabled  = false;
                        other.Items[i].Enabled = true;
                    }
                    else
                    {
                        list.Items[i].Enabled = true;
                    }
                }

                // Switch status of other list checkboxes
                for (int i = 0; i < other.Items.Count; i++)
                {
                    if (i > 0 && other.Items[0].Selected)
                    {
                        other.Items[i].Selected = false;
                        other.Items[i].Enabled  = false;
                    }
                    else
                    {
                        if (other.Items[i].Enabled && list.Items[i].Enabled && list.Items[i].Selected)
                        {
                            other.Items[i].Selected = false;
                        }
                    }
                }
            }
        }