I know now what the problem is, but don't know how to solve it!
My data structure is:
TranslationEntity
int Id {get;set;}
string InternalName {get;set;}
string ExternalName {get;set;}
UserEntity UserUpdate {get;set;} This is a custom object giving me problem
My datasource has a list of the above entity.
Now lets say I do selectedRecord.SetValue("UserUpdate_Username", "New value for this cell"); the value is not applied for the cell itself, but the UserUpdate instance in the grid. But what I want is to edit only the selectedRecord cell, not the UserUpdate instance.
Just for testing purpose I've filled the list the way below and the issue occurred. The problem with the "solution" in red, is that since i'm using NHibernate, i'm not looping anything, all I do is return the criteria.List<TranslationEntity>() method, and even if I was considering on looping though the NHibernate result and instantiating an instance for each row, that would not be appropriate, for memory limitations concerns. I'm sorry for the huge text, but I really need to solve this! =/
public IList<TranslationEntity> GetTest()
{
List<TranslationEntity> list = new List<TranslationEntity>();
UserEntity userUpdate = new UserEntity();"SOLUTION" When I instantiate this object OUTSIDE the for loop, the error OCCURS, but when I instantiate it inside the for loop, the error DOESN'T OCCUR.
for(int i = 0; i < 50; i++)
{
TranslationTypeEntity typeEntity = new TranslationTypeEntity();
typeEntity.Id = 12;
typeEntity.Name = "Programa";
userUpdate.Id = 12;
userUpdate.Username = "vandeg";
TranslationEntity entity = new TranslationEntity();
entity.Id = 12;
entity.InternalName = "Nome Interno " + i;
entity.ExternalName = "Nome Externo" + i;
entity.DateInclusion = DateTime.Now;
entity.DateUpdate = DateTime.Now;
entity.TranslationTypeEntity = typeEntity;
entity.UserInclusion = userInclusion;
entity.UserUpdate = userUpdate;
list.Add(entity);
}
return list;
}