devexpressrepositorylookupedit

Devexpress RespositoryLookUpEdit in grid , the value disaper


I have a devexpressgridcontrol. I want to use in one column of the grid : repositoryLookUpEdit. I fill repositoryLookUpEdit with database question. This question return three columns : IdPerson , Name and IdCity. Colums : IdPerson and Name have data but IdCity I have to set in appication.

So - in gridcontrol the column Idcity has fildename : IdCity, and columnEdit : repositoryLookUpEdit. - repositoryLookUpEdit has DisplayValue : CityName, and ValueMember: IdCity.

And my question is:

When I choose in grid in one row value of city and I go to another row, the value from the first row disaper.

What am I doing wrong? Could you give me some advise?

I use 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;

Solution

  • You have to set ValueMember for replueCity (which is the editor in the column). You set it only for replueOceny.

    Check string IdCity in all three cases: it must be written exactly the same (mind the caps!).