[英]DevExpress GridView: how to add a LookUpEdit cell
The problem is this: I have a GridView with several columns and I want a few of them to contain LookUpEdit items. 问题是这样的:我有一个带有几列的GridView ,并且我希望其中一些包含LookUpEdit项。 I get the same error in all of them so I'll share the easies one:
我在所有这些错误中都遇到了相同的错误,因此我将分享一些简单的内容:
In this code there should be simply 2 options YES or NO but all I get is the null string value in them. 在这段代码中,应该只有两个选项YES或NO,但我得到的只是其中的空字符串值。
// Create a DataSet that contain the 2 values NO and YES and their keys
DataTable dsSiNO = new DataTable("dsSiNO");
dsSiNO.Columns.Add("Valor", typeof(Decimal));
dsSiNO.Columns.Add("Tipo");
dsSiNO.Rows.Add(0, @""+MsgResources.GetString("MsgNo"));
dsSiNO.Rows.Add(1, @"" + MsgResources.GetString("MsgYes"));
// Create the LookUpEdit variable and set it's options
DevExpress.XtraEditors.Repository.RepositoryItemLookUpEdit myLookup = new DevExpress.XtraEditors.Repository.RepositoryItemLookUpEdit();
myLookup.ShowHeader = false;
myLookup.ShowFooter = false;
myLookup.DataSource = dsSiNO ;
myLookup.Columns.Add(new DevExpress.XtraEditors.Controls.LookUpColumnInfo("Valor"));
myLookup.Columns.Add(new DevExpress.XtraEditors.Controls.LookUpColumnInfo("Tipo"));
myLookup.DisplayMember = "Tipo";
myLookup.ValueMember = "Valor";
// Finally set the LookUpEdit object to the column
gColNEGOCIO.ColumnEdit = myLookup;
All I get are cells with an "[Empty]" String. 我得到的都是带有“ [Empty]”字符串的单元格。
问题出在GridView配置中:OptionsBehavior Editable设置为False!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.