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. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

QueryCellStyleInfo

Thread ID:

Created:

Updated:

Platform:

Replies:

147521 Sep 13,2019 04:45 PM UTC Sep 17,2019 06:06 AM UTC WinForms 3
loading
Tags: GridGroupingControl
Ricardo Abranches
Asked On September 13, 2019 04:45 PM UTC

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
Ricardo

Mohanraj Gunasekaran [Syncfusion]
Replied On 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. 
 
VB 
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 
                              Return 
               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 

Screenshot 
 


Please refer the following KB link, 

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

Regards, 
Mohanraj G 


Ricardo Abranches
Replied On September 16, 2019 12:06 PM UTC

Thanks for your help.

Best regards

Arulpriya Ramalingam [Syncfusion]
Replied On 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. 
 
Regards, 
Arulpriya  


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon