[DevExpress]控件-checkboxlist之运用

数据绑定:

            string strSql = "SELECT [UserName],[Mail] FROM [OA].[dbo].[DZ_Users]";
            DataTable dt = new DataTable();
            dt = DbHelperSQL.Query(strSql.ToString()).Tables[0];


            chklboxL.DataSource = dt;
            chklboxL.DisplayMember = "UserName";
            chklboxL.ValueMember = "Mail";


            this.checkedComboBoxEdit1.Properties.DataSource = dt;
            this.checkedComboBoxEdit1.Properties.DisplayMember = "UserName";
            this.checkedComboBoxEdit1.Properties.ValueMember = "Mail";

            checkedComboBoxEdit1.EditValue = "[email protected],[email protected]";     //默认值

获取:

       string mail = string.Empty;
            DataRowView value = chklboxL.SelectedValue as DataRowView;
            BaseCheckedListBoxControl.CheckedItemCollection checkboxs = chklboxL.CheckedItems;
            foreach (DataRowView item in checkboxs)
            {
                string name = item["UserName"].ToString();
                mail += item["Mail"].ToString() + ",";
            }
            XtraMessageBox.Show(mail.Substring(0, mail.Length - 1), "警告");

效果:

[DevExpress]控件-checkboxlist之运用_第1张图片


你可能感兴趣的:([DevExpress]控件-checkboxlist之运用)