Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
222
ComboEditor with UltraGrid
posted

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.)

 

Parents
  • 918
    posted

    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.

Reply Children