Esempio n. 1
0
        private IList <CboItemEntity> ToList(DataTable dt)
        {
            IList <CboItemEntity> list = new List <CboItemEntity>();

            DataRow[] drs = dt.Select(null);
            foreach (DataRow dr in drs)
            {
                CboItemEntity item = new CboItemEntity();
                item.Text  = dr[0].ToString();
                item.Value = dr[0].ToString();
                list.Add(item);
            }
            return(list);
        }
Esempio n. 2
0
        private void ComboBoxEdit_SelectedIndexChanged1(object sender, EventArgs e)
        {
            CboItemEntity item = new CboItemEntity();

            try
            {
                //1.获取下拉框选中值
                item = (CboItemEntity)(sender as ComboBoxEdit).SelectedItem;
                string text  = item.Text.ToString();
                string value = item.Value.ToString();

                //2.获取gridview选中的行
                GridView myView = (gridControl1.MainView as GridView);
                int      index  = myView.GetDataSourceRowIndex(myView.FocusedRowHandle);
                //3.保存选中值到datatable
                FieldDT.Rows[index]["FIELD"] = value;
                this.gridControl1.DataSource = FieldDT;
            }
            catch (Exception ex)
            {
                XtraMessageBox.Show(ex.Message, "提示");
            }
        }