I'm new to Ultragrid. I'd like to string together a default value in a cell on an Ultragrid based on another value on INSERT. It works if I use the property on the designer but
I can't add the additional value. Something like:
UltraGridList.DisplayLayout.Bands[0].Columns["YES_NO"].DefaultCellValue = "The value for Joe is: " + choice;
I tried using something like this, but I don't know that the row will be zero.
UltraGridList.Rows[0].Cells["YES_NO"].Value = "The value for Joe is: " + choice;
Hi Tony,
DefaultCellValue applies to the entire column - which means it applies to every row. There's no way to apply a DefaultCellValue to a single cell - at least not with a property.
If I understand correctly what you are trying to do, then I think you need to use an event for this. Maybe AfterRowInsert. In this event, you could examine the row, look at it's index, and based on that, you could set the value of the "YES_NO" cell to whatever value you want.
Hi,
Thanks for your reply. This is new to me, so there may be a better/another way.
I was able to use the AfterCellUpdate event, but had set set a "search mode" flag so when searching it would read the value from the database and not from the cell values, otherwise I was getting a null value reference since FIELD1 and FIELD2 were not set yet.
So basically if FIELD1 or FIELD2 changes re-concatenate it in FIELD3:
private void UltraGridList_AfterCellUpdate(object sender, CellEventArgs e){ if ((e.Cell.Column.Key.ToUpper().Equals("FIELD1") || e.Cell.Column.Key.ToUpper().Equals("FIELD2")) & !searchmode) UltraGridList.ActiveRow.Cells["FIELD3"].Value = "CUSTOM CHG FOR " + UltraGridList.ActiveRow.Cells["FIELD1"].Value + " - " + UltraGridList.ActiveRow.Cells["FIELD2"].Value;}