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

Conditional formatting

Thread ID:





61019 May 16,2007 07:32 PM UTC May 17,2007 02:27 AM UTC WinForms 2
Tags: Grouping
Jon Pope
Asked On May 16, 2007 07:32 PM UTC

I'm working with the GridGroupingControl. I've got a column that consists of a fixed list of numeric IDs (1, 2, 3). What I would like to do is replace those IDs with readable values at runtime:

1 = Hello
2 = Goodbye
3 = Ciao

I've been looking at conditional formatting, but can't find a way to replace the number with strings. (It works great for adjusting appearance settings, however.)

Am I looking in the wrong place?

Cheers, Jon

haneefm [Syncfusion]
Replied On May 16, 2007 11:21 PM UTC

Hi Jon,

If you are using a GridGroupingControl, then use TableControlDrawCellDisplayText event and set e.DisplayText there to easily control what text is drawn in the cell.

void gridGroupingControl1_TableControlDrawCellDisplayText(object sender, GridTableControlDrawCellDisplayTextEventArgs e)
GridTableCellStyleInfo style = (GridTableCellStyleInfo)e.Inner.Style;
if(style.TableCellIdentity.Column != null
&& style.TableCellIdentity.Column.MappingName == "ColumnName")
object objValue = e.Inner.Style.CellValue;
f( objValue != null
&& objValue.ToString() != string.Empty)
int iCellValue = int.Parse(objValue.ToString());
case 1:
e.Inner.DisplayText = "Hello";
case 2:
e.Inner.DisplayText = "Goodbye";
case 3:
e.Inner.DisplayText = "Ciao";

Best regards,

Jon Pope
Replied On May 17, 2007 02:27 AM UTC

Thanks, that did the trick!


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

or the page will be automatically redirected to 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