【问题标题】:Devexpress RespositoryLookUpEdit in grid , the value disaper网格中的 Devexpress RepositoryitemLookUpEdit ,值消失
【发布时间】:2014-12-02 09:55:12
【问题描述】:

我有一个 devexpressgridcontrol。我想在网格的一列中使用:repositoryLookUpEdit。 我用数据库问题填充 repositoryLookUpEdit。 此问题返回三列:IdPerson、Name 和 IdCity。列:IdPerson 和 Name 有数据,但 IdCity 我必须在应用程序中设置。

所以 - 在 gridcontrol 中,Idcity 列具有 fildename:IdCity 和 columnEdit:repositoryLookUpEdit。 - repositoryLookUpEdit 具有 DisplayValue : CityName 和 ValueMember: IdCity。

我的问题是:

当我在城市的一行值的网格中选择并转到另一行时,第一行的值会消失。

我做错了什么?你能给我一些建议吗?

我使用 Devexpress 9.2。

this.gvPerson = new DevExpress.XtraGrid.Views.Grid.GridView(); 
this.replueCity = new DevExpress.XtraEditors.Repository.RepositoryItemLookUpEdit();
this.replueCity.Columns.AddRange(new DevExpress.XtraEditors.Controls.LookUpColumnInfo[] { new     DevExpress.XtraEditors.Controls.LookUpColumnInfo("IdCity", "IdCity", 20,     DevExpress.Utils.FormatType.None, "", false, DevExpress.Utils.HorzAlignment.Default), new DevExpress.XtraEditors.Controls.LookUpColumnInfo("CityName", "CityName")});
this.replueCity.DisplayMember = "CityName"; 
this.replueCity.Name = "replueCity"; 
this.replueCity.NullText = "[Choose city]"; 
this.replueCity.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.Standard; 
this.replueOceny.ValueMember = "IdCity"; 
// CityColumn this.CityColumn.AppearanceCell.Options.UseTextOptions = true; 
this.CityColumn.AppearanceCell.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center; 
this.CityColumn.AppearanceCell.TextOptions.VAlignment = DevExpress.Utils.VertAlignment.Center; 
this.CityColumn.Caption = "Ocena"; 
this.CityColumn.ColumnEdit = this.replueCity; 
this.CityColumn.FieldName = "IdCity"; 
this.CityColumn.Name = "IdCityName"; 
this.CityColumn.Visible = true;

【问题讨论】:

  • 在所有三种情况下检查字符串“IdCity”:它必须写得完全相同(注意大写!)
  • 我会检查,但它不起作用。
  • 然后粘贴一些代码...
  • 把它传递给你的问题,它在 cmets 中不可见
  • 我从designer.cs中获取这段代码 this.gvPerson = new DevExpress.XtraGrid.Views.Grid.GridView(); this.replueCity = new DevExpress.XtraEditors.Repository.RepositoryItemLookUpEdit();

标签: devexpress repositorylookupedit


【解决方案1】:

您必须将ValueMember 设置为replueCity(即列中的编辑器)。你只为replueOceny设置它。

在所有三种情况下检查字符串IdCity:它的写法必须完全相同(注意大写!)。

【讨论】:

  • 我只为 replueOceny 设置了 ValueMember,但它仍然不起作用。当我从网格中的 replookUpEdit 中选择值,然后转到下一行时,第一行的值消失了。 yhhh我做错了什么!!!!
  • 谢谢大家给我建议。我解决了我的问题。因为我从 DataBase 的 DataTable 填充了 repleeCity,并且我用来自同一个数据库的另一个 DataTable 填充了这个网格,但我使用了不同的选择。并且在网格中 DataTable 不是用于填充 repleeCity 的列。
猜你喜欢
  • 1970-01-01
  • 2014-03-05
  • 1970-01-01
  • 1970-01-01
  • 2014-09-26
  • 1970-01-01
  • 2015-10-10
  • 1970-01-01
  • 2023-03-17
相关资源
最近更新 更多