using (DevExpress.Utils.WaitDialogForm dlg = new DevExpress.Utils.WaitDialogForm("请稍等", "查询中......", new System.Drawing.Size(100, 50))) { string sqlString = "SELECT ITEM ,DESCRIPTION ,CATEGORY3 FROM WIPDBA.TIME_IMA x WHERE x.SITE = '1140' ";//and x.ITEM = '1000080309' var aa = ado.ExecuteDataTable(sqlString); gridControl1.DataSource = aa; //string fieldtitle = "物料组名称"; //string fieldname = "物料组名称"; //DevExpress.Data.UnboundColumnType ctype = DevExpress.Data.UnboundColumnType.String; //gridView1._创建一个非绑定列(fieldname, fieldtitle, ctype); } gridView1.CustomUnboundColumnData += GridView1_CustomUnboundColumnData;
config.物料描述缓存 = DB.xmdb.Select<Z_ERP_T023T>().ToList();
private void GridView1_CustomUnboundColumnData(object sender, DevExpress.XtraGrid.Views.Base.CustomColumnDataEventArgs e) { if (e.Column.FieldName == "物料组名称" && e.IsGetData) e.Value = config.物料描述缓存.Find(a => a.MATKL == (e.Row as DataRowView).Row["CATEGORY3"]?.ToString())?.WGBEZ; }标签:物料,string,数据源,绑定,DevExpress,CustomUnboundColumnData From: https://www.cnblogs.com/hlm750908/p/18672068