protected bool IsEditionValid(GridItem item, GrilleColumn column, string oldValue, string newValue, GridCellValidationEventArgs args) { int? oid = item.GetOid(); bool isKey = column.position == 0; if (isKey) { if (string.IsNullOrWhiteSpace(newValue)) { args.ErrorContent = column.name + " can't be empty!"; args.IsValid = false; return(false); } } else if (!oid.HasValue) { LinkedAttributeGrid grid = (LinkedAttributeGrid)this.Grille; Object keyValue = item.Datas[0]; bool emptyKeyValue = keyValue == null || string.IsNullOrWhiteSpace(keyValue.ToString()); if (emptyKeyValue && !grid.attribute.incremental) { args.ErrorContent = "You have to set " + grid.attribute.name + " before set " + column.name; args.IsValid = false; return(false); } } return(true); }
public override void buildColumns(Grille grille) { if (grille is LinkedAttributeGrid) { LinkedAttributeGrid grid = (LinkedAttributeGrid)grille; this.Grille = grid; buildGrid(); int position = 0; GrilleColumn column = new GrilleColumn(grid.attribute, position++); grid.AddColumn(column); this.AddColumn(column, grid.attribute.incremental); foreach (Kernel.Domain.Attribute attribute in grid.attribute.childrenListChangeHandler.Items) { column = new GrilleColumn(attribute, position++); grid.AddColumn(column); this.AddColumn(column, attribute.incremental); } this.Children.Add(this.gridControl); RebuildGrid = false; } }