我有这个问题好几天了,找不到解决的办法。我尝试了我在互联网上找到的所有可能的解决方案,但似乎都不适合这个解决方案。问题是我向gridControls添加了存储库项(我是通过设计器添加的,而不是通过代码添加的)。然后,在代码中,我将数据源添加到存储库lookUpEdit中,并且在该列中有dropDown中的项。但是当我选择存储库中的项并单击其他单元格时,存储库中的选定项将被清除,并且存储库再次显示空值。知道我做错了什么吗?
编辑:同样,当我点击我的网格中的任何单元格时,我有一两秒钟的延迟,在那个延迟之后,单击的单元格被聚焦.对这一切有什么解决办法吗?
编辑:不知道该向您展示什么代码,因为我都是在devExpress designer中做的。下面是我将数据源设置为存储库项的代码的一部分,我将为您提供来自该存储库项的设计人员的代码。
private void ConfigureRepositoryItems()
{
BetService.SportManagerClient dbSportManager = new BetService.SportManagerClient();
BetService.BLOddsControlSettings[] oddsControlSettings = dbSportManager.GetOddsControlSettings("", "");
repositoryOddsControlSettings1.DataSource = oddsControlSettings;
}下面是设计师的代码:
//
// repositoryOddsCalculationSettings1
//
this.repositoryOddsCalculationSettings1.AutoHeight = false;
this.repositoryOddsCalculationSettings1.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] {
new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)});
this.repositoryOddsCalculationSettings1.Columns.AddRange(new DevExpress.XtraEditors.Controls.LookUpColumnInfo[] {
new DevExpress.XtraEditors.Controls.LookUpColumnInfo("ID", "ID", 20, DevExpress.Utils.FormatType.None, "", false, DevExpress.Utils.HorzAlignment.Default),
new DevExpress.XtraEditors.Controls.LookUpColumnInfo("Name", "Name")});
this.repositoryOddsCalculationSettings1.DisplayMember = "Name";
this.repositoryOddsCalculationSettings1.Name = "repositoryOddsCalculationSettings1";
this.repositoryOddsCalculationSettings1.NullText = "Select Settings";
this.repositoryOddsCalculationSettings1.PopupSizeable = false;
this.repositoryOddsCalculationSettings1.ValueMember = "ID";发布于 2015-03-18 14:23:46
首先,检查Grid数据源中的列名与网格控件中的列是否匹配。匹配是区分大小写的,因此name和Name不一样,因此可能导致此问题。其次,确保Grid数据源列数据类型与LookUpEdit的值类型匹配。如果LookupEdit返回的是int,而Grid数据源列的数据类型是string,那么仅这一点就会引起很多麻烦。
https://stackoverflow.com/questions/20421786
复制相似问题