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

Change Font Color of Rows

Thread ID:





62813 Jun 22,2007 11:31 AM UTC Jun 22,2007 05:33 PM UTC WinForms 1
Tags: GridControl
Asked On June 22, 2007 11:31 AM UTC


I would want to change the Font Color of Specific rows depending on some condition, The code I am using is as follows :

private void dgrdCato_PrepareViewStyleInfo(object sender, GridPrepareViewStyleInfoEventArgs e)
if (e.RowIndex > 0)
if (dgrdCato[e.RowIndex, 6].Text.ToString().Equals("Active"))
e.Style.TextColor = Color.Green;
e.Style.TextColor = Color.Red;

However the above is not working, kindly help.

Rajagopal [Syncfusion]
Replied On June 22, 2007 05:33 PM UTC

Hi Raul,

You need to catch the PrepareViewStyleInfo event of the grid to do this. In the event handler, you need to check your condition based on e.RowIndex and e.ColIndex, and then conditionally set e.Style.TextColor.

void gridControl1_PrepareViewStyleInfo(object sender, GridPrepareViewStyleInfoEventArgs e)
if (e.RowIndex > 0 && e.ColIndex > 0)
if (e.Style.Text == "Active")
e.Style.TextColor = Color.Green;
e.Style.TextColor = Color.Red;

Let us know if you need any further help.


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