I am so frustrated with the UltraGrid right now... I have a grid, one band, that has five columns that need to have their STYLE set to DropDownList. I've set the style on the columns but for some reason the cells aren't inheriting that setting. When the grid is displayed, the add row has those five cells as regular editable text cells versus a drop-down list.
In the InitializeRow event I added this debugging code:
MsgBox(grid.DisplayLayout.Bands(0).Columns("col1").Style.ToString)MsgBox(grid.DisplayLayout.Bands(0).Columns("col2").Style.ToString)...
the result of these is "DropDownList"
plus this code:
MsgBox(e.Row.Cells("col1").Style.ToString)MsgBox(e.Row.Cells("col2").Style.ToString)
the result of these is "Default".
So during InitializeRow the grid sees the styles of the columns as DropDownList but the actually cells in the add row are Default style.
Any idea why this might be happening?
More info... these columns have their ValueList set to an actual VL.
In InitializeRow, I just tried this: e.Row.Cells("col1").Style = ColumnStyle.DropDownList e.Row.Cells("col2").Style = ColumnStyle.DropDownList ... MsgBox(e.Row.Cells("col1").Style.ToString) MsgBox(e.Row.Cells("col2").Style.ToString) ...
The message boxes display "DropDownList" but the cells do not have a drop-down and are basically editable text cells. Something is preventing these cells from taking on the drop-down list style and I don't know why...
OK, I think I've figured it out. The ValueList for the first column wasn't being populated properly. An exception should have been raised, but it wasn't. No idea why - I was trying to access a NULL object. The code kept on going but basically stopped assigning value lists but did set styles. The form displayed and the column styles were properly set but the lack of value lists basically left the columns/cells as text cells. Very weird!
Okay good catch!. Let us know if you need any further assistance.