How set a different color to a drop down grid ?

Hi, I use this code : If StatutTache(Me.gridFavoris(cc.RowIndex, COL_TACHE).CellValue) = False Then Me.gridFavoris.RowStyles(cc.RowIndex).BackColor = Color.Red Else If StatutProjet(Me.gridFavoris(cc.RowIndex, COL_PROJET).CellValue) = STATUT_PROJET_VALIDE Then Me.gridFavoris.RowStyles(cc.RowIndex).BackColor = Color.White End If End If to validate on a drop down element and set the red color on error for all the row of a databound grid. But, I want to set the white color to my drop down list. The problem that I see is that my drop down list inherits of my cell and the red color. I can''t by pass this. How I can do that !!! thanks

1 Reply

AD Administrator Syncfusion Team July 12, 2005 06:31 PM UTC

I am not really sure why this is working for you in a GridDataBoundGrid (unless you have explicitly set grid.Model.RowCount to allocate space for row styles). Normally, a GridDataBoundGrid does not have rowstyles. Anyway, you can try handling the CurrentCellShowingDropdown event and set the backcolor of the drop list there. Private Sub gridControl1_CurrentCellShowingDropDown(sender As Object, e As GridCurrentCellShowingDropDownEventArgs) Dim cc As GridCurrentCell = Me.gridControl1.CurrentCell Dim cr As GridComboBoxCellRenderer = cc.Renderer '' If Not (cr Is Nothing) Then cr.ListBoxPart.BackColor = Color.LightGoldenrodYellow End If End Sub ''gridControl1_CurrentCellShowingDropDown

Loader.
Up arrow icon