We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date


I am trying to use this event (QueryCellStyleInfo) for the following:

when the cell of a given column is less than 1 then e.Style.BackColor = Color.Red

but I can't figure out how to know if I'm in the cell that interests me.

can you give me an example on vb.net

Thank you

3 Replies

MG Mohanraj Gunasekaran Syncfusion Team September 16, 2019 11:40 AM UTC

Hi Ricardo, 
Thanks for contacting Syncfusion support. 
To change the BackColor for specific cells using QueryCellStyleInfo event, you could use the CellValue and Column property. Please refer the following code example and the sample. 
AddHandler Me.gridGroupingControl1.QueryCellStyleInfo, AddressOf GridGroupingControl1_QueryCellStyleInfo 
Private Sub GridGroupingControl1_QueryCellStyleInfo(ByVal sender As Object, ByVal e As GridTableCellStyleInfoEventArgs) 
               If e.TableCellIdentity Is Nothing OrElse e.TableCellIdentity.Column Is Nothing Then 
               End If 
    'To get the specific column 
    If e.TableCellIdentity.Column.Name = "Freight" AndAlso e.TableCellIdentity.DisplayElement IsNot Nothing AndAlso e.TableCellIdentity.DisplayElement.Kind = Syncfusion.Grouping.DisplayElementKind.Record Then 
        Dim text As String = e.Style.CellValue.ToString() 
        Dim value As Double 
        If Double.TryParse(text, value) Then 
            If value > 1000 Then 
                e.Style.BackColor = Color.Red 
                e.Style.TextColor = Color.White 
            End If 
        End If 
    End If 
End Sub 


Please refer the following KB link, 

Please get back to us if you need any further assistance on this. 

Mohanraj G 

RA Ricardo Abranches September 16, 2019 12:06 PM UTC

Thanks for your help.

Best regards

AR Arulpriya Ramalingam Syncfusion Team September 17, 2019 06:06 AM UTC

Hi Ricardo, 
Thanks for the update. 
We are glad to know that the reported use case is resolved at your end and we are happy to assist you. Please revert to us, if you have any other queries. 

Live Chat Icon For mobile
Up arrow icon