I have an ultracomboeditor using a dataset datasource set as the editorcontrol on one of the columns in an ultragrid based on another datasource. I want the dropdown items of the comboeditor to have different forecolors based on another value in the item's datarow and another data value in the ultragrid row. Is there a way to do this?
For example:
The Ultragrid has an available rooms column. The user can select a room from a comboeditor tied to a "rooms" datatable. Each room has a maximum occupancy value. The ultragrid also has an expected occupancy column. When the user drops down the rooms list, I'd like it to display rooms whose maximum occupancy is less than the expected occupancy in a different color so the user can see that the room may not work. (I don't want to filter out rooms from the list, because the user could override.)
I'm not trying to change the grid colors. I'm trying to change the combo's dropdown item colors, so that when they are looking at the list of options on the dropdown, they can see that it might not be optimal.
It sounds like the you're already going to have the dropdown loaded and the user will fill in the expected occupancy. if thats correct you will not be able to use the initialize row event so you'll need to write a sub to to the work.
Private sub ChangeRowColor(expectedocc as integer)
dim orow as ultragridrow
dim i as integer
for i =0 to mycombo.rows.count-1
if mycombo.rows(i).cells("Occupancy").value > expectedocc then
oRow.Appearance.BackColor = Color.CadetBlue
else
oRow.Appearance.BackColor = nothing 'this will reset the color to default
end if
next
if you load the combo after the the expected occupancy is set then use the initialize row event.