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.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

gridgroupin control cell conditional formating from value from another column

Thread ID:

Created:

Updated:

Platform:

Replies:

121387 Dec 8,2015 09:33 PM UTC Dec 10,2015 10:44 AM UTC Windows Forms 3
loading
Tags: GridGroupingControl
panos veinoglou
Asked On December 8, 2015 09:33 PM UTC

hi i am evaluating ggc. i try to conditionally format a cell based on a value from another cell from the same row.
ie if col a row 5 value >5 then col b row 5 cell backcolor=5


i have somehow managed to do it using QueryCellStyleInfo but the grid crashes after using the field chooser to change the displayed columns

any help woud be greatly appreciated.



Solai A L [Syncfusion]
Replied On December 9, 2015 06:43 AM UTC

Hi Panos,

Thank you for using Syncfusion products.

Instead of using QueryCellInfo event for conditional formatting, you can use the GridConditionalFormatDescriptor. Please refer to the below code example and sample for reference. 

Code Example :


Syncfusion.Windows.Forms.Grid.Grouping.GridConditionalFormatDescriptor gridConditionalFormatDescriptor1 = newSyncfusion.Windows.Forms.Grid.Grouping.GridConditionalFormatDescriptor();

gridConditionalFormatDescriptor1.Appearance.AnyRecordFieldCell.Interior = newSyncfusion.Drawing.BrushInfo(System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(191)))), ((int)(((byte)(52))))));

gridConditionalFormatDescriptor1.Appearance.AnyRecordFieldCell.TextColor = System.Drawing.Color.White;

gridConditionalFormatDescriptor1.Expression = "[CustomerID]  LIKE \'A*\'";

gridConditionalFormatDescriptor1.Name = "ConditionalFormat 1";



Sample :
http://www.syncfusion.com/downloads/support/forum/121387/ze/CS-2110415607

Note :
If the issue is still not resolved, please replicate your issue in this sample and send it to us, so that it would help us provide a prompt solution.

Thanks,

AL.Solai.


panos veinoglou
Replied On December 9, 2015 07:10 AM UTC

Thanks for the reply, but I only want to format one cell

Solai A L [Syncfusion]
Replied On December 10, 2015 10:44 AM UTC

Hi Panos,

Thank you for your update.

We have changed the sample with conditional formatting for the single cell value using the QueryCellInfo event and also tried using the field chooser. The sample is working fine at our end. Could you please replicate the issue scenario in this sample and update us?
Code Example :

   void gridGroupingControl1_QueryCellStyleInfo(object sender, Syncfusion.Windows.Forms.Grid.Grouping.GridTableCellStyleInfoEventArgs e)

        {

           if(e.TableCellIdentity.ColIndex>0 && e.TableCellIdentity.RowIndex>0 && e.Style.Text == "Sales Representative")

           {

               e.Style.BackColor = Color.GreenYellow;

           }

        }
Modified Sample :
http://www.syncfusion.com/downloads/support/forum/121387/ze/CS_(2)161555433

Note : QueryCellInfo event would be triggered frequently. So, using this event for a single condition will not be an appropriate solution. It may affect the performance when a large data is involved.

Thanks,
AL.Solai.


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.

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

;