2

我有这个问题好几天了,找不到解决办法。我尝试了我在互联网上找到的所有可能的解决方案,但似乎没有一个适合这个。事情是我将存储库项添加到 gridControls (我通过设计器添加它,而不是通过代码)。然后,在代码中,我将数据源添加到该存储库lookUpEdit,并且我在该列的下拉菜单中有项目。但是当我在存储库中选择项目并单击其他单元格时,存储库中的选定项目被清除并且存储库再次显示空值......任何想法我做错了什么?

编辑:另外,当我单击网格中的任何单元格时,我会有一两秒的延迟,并且在延迟之后单击的单元格被聚焦......所有这些的任何解决方案?

编辑:不知道要向您展示什么代码,因为我在 devExpress 设计器中完成了所有工作。这是我将数据源设置为存储库项的代码的一部分,我将从该存储库项的设计器中为您提供代码。

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";
4

1 回答 1

1

对于初学者,请检查Grid数据源中的列名和网格控件中的列是否匹配。匹配区分大小写,因此nameName相同,因此可能导致此问题。其次,确保Grid数据源列数据类型与LookUpEdit. 如果LookupEdit正在返回int并且Grid数据源列数据类型为string,仅此一项就会引起很多麻烦。

于 2015-03-18T14:23:46.737 回答