private void SetGridLookupEditDisplayMember(GridView gv, RepositoryItemLookUpEditBase Le, string DisplayMember, IEntityCollection eColl, bool AlwaysSet) { GridColl FindGc = null; foreach (GridColl gc in ListGrid) { if (gc.gv == gv) { FindGc = gc; break; } } if (FindGc == null) { GridColl gc = new GridColl(gv, eColl, pe); if (Le != null) { gc.SetLookupEditDisplayMember(Le, DisplayMember, AlwaysSet); } ListGrid.Add(gc); if (gv.LevelName.Length > 0) { DictGrid[gv.LevelName] = ListGrid.Count - 1; } else if (eColl == null) { DictGrid[((BindingSource)gv.GridControl.DataSource).DataMember] = ListGrid.Count - 1; } else { DictGrid[eColl.ChildName] = ListGrid.Count - 1; } } else if (Le != null) { FindGc.SetLookupEditDisplayMember(Le, DisplayMember, AlwaysSet); } if (FindGc != null && eColl != null) { FindGc.eColl = eColl; } }
void frmSingletonEntity_CustomColumnDisplayText(object sender, CustomColumnDisplayTextEventArgs e) { RepositoryItemLookUpEditBase rle = e.Column.ColumnEdit as RepositoryItemLookUpEditBase; if (rle == null) { return; } GridView gv = (GridView)sender; string TableName = gv.LevelName; IEntityCollection eColl = (IEntityCollection)gv.DataSource; GridColl gc = ListGrid[DictGrid[TableName]]; gc.UpdateDisplayText(eColl, e); }