public void comboBoxEdit_EditValueChanged(object sender, EventArgs e) { UserGroup userGroup = GetUserGroupFromGroupName(listBoxUserGroups.SelectedItem.ToString()); int row = this.vGridControl.FocusedRow.Index; if (row == 3) { if (userGroup.nStatus == 0) { userGroup.nStatus = 2; } userGroup.AllowApps = ""; // 模块列表 foreach (CheckedListBoxItem item in comboBoxEdit.GetItems()) { if (item.CheckState == CheckState.Checked) { userGroup.AllowApps += item.Value.ToString(); userGroup.AllowApps += ", "; } } userGroup.AllowApps = userGroup.AllowApps.TrimEnd(' '); userGroup.AllowApps = userGroup.AllowApps.TrimEnd(','); } else if (row == 4) { // 权限列表 if (userGroup.nStatus == 0) { userGroup.nStatus = 2; } userGroup.Roles = ""; foreach (CheckedListBoxItem item in comboBoxEdit.GetItems()) { if (item.CheckState == CheckState.Checked) { userGroup.Roles += item.Description.ToString(); userGroup.Roles += ", "; } } userGroup.Roles = userGroup.Roles.TrimEnd(' '); userGroup.Roles = userGroup.Roles.TrimEnd(','); } }
/// <summary> /// 绑定 CheckedComboBox /// </summary> /// <param name="dt"></param> /// <param name="lst"></param> /// <param name="description"></param> /// <param name="value"></param> public static void BindCheckedComboBoxEdit(DataTable dt, RepositoryItemCheckedComboBoxEdit lst, string description, string value) { lst.DataSource = dt; lst.DisplayMember = description; lst.ValueMember = value; lst.SelectAllItemCaption = "选择全部"; lst.SelectAllItemVisible = true; lst.ShowButtons = false; lst.GetItems(); }