[DevExpress]控件-checkboxlist之运用

来源:互联网 发布:sqlserver列转行函数 编辑:程序博客网 时间:2024/06/05 09:10

数据绑定:

            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 = "test1@zettlercn.com,test2@zettlercn.com";     //默认值

获取:

       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), "警告");

效果:



0 0
原创粉丝点击