I am rendering a tree like hierarchy using UltraGrid on two parent-child DataTables
aaaa
xxxx
yyyy
bbbb
zzzz
In place of datafield value xxxx, I want it to show "xxxx (desc of xxxx)" where "desc of xxxx" is value of another datafield on that datarow. In other words, on the Grid I want to show a concatenated value of the two datafields instead of the data field itself.
I am hoping for a solution using UltraGrid itself and not have to create a new calculated column on that datatable.
Thanks!
Yes, you are correct; assigning a ValueList to the column will get you the behavior you describe here.
Note that the grid will automatically resolve its editor to a dropdown when you do this, so if you don't want that, you might have to override the default behavior.
You can do this by either changing the column's Style to 'Edit', or by explicitly assigning an EditorWithText to the Editor property.
Thanks Brian!
I thought there was some capability in WinGrid which allowed for a different value to be display in place of the cell value.
So for example if I have two datafields ID and Desc on datatable, I thought there is some capability which lets me have ID as the underlying value while Desc shows on UI to the user. So when user clicks on Desc, the underlying ID value would get sent over to business logic.
Is there some capability like that which I can leverage here?
1. Handle InitializeLayout and add a column to the e.Layout.Bands[n].Columns collection, where n is the index of the band.
2. Handle InitializeRow, and set the e.Row.Cells[x].Value to the concatenated value (where x represents the index or key of the column you added above).