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.

Conditional formatting

Thread ID:

Created:

Updated:

Platform:

Replies:

61019 May 16,2007 03:32 PM May 16,2007 10:27 PM Windows Forms 2
loading
Tags: Grouping
Jon Pope
Asked On May 16, 2007 03:32 PM

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 07:21 PM

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());
switch(iCellValue)
{
case 1:
e.Inner.DisplayText = "Hello";
break;
case 2:
e.Inner.DisplayText = "Goodbye";
break;
case 3:
e.Inner.DisplayText = "Ciao";
break;
}
}
}
}

Best regards,
Haneef

Jon Pope
Replied On May 16, 2007 10:27 PM

Thanks, that did the trick!

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.

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.

;