all groups > asp.net datagrid control > november 2004 >
You're in the

asp.net datagrid control

group:

Conditional formating



Conditional formating Willem
11/27/2004 1:17:10 AM
asp.net datagrid control: Hi,

I'm working with a datagrid whithout any problem. But now
I like to use some condinional formating to one of the
columns. If the value in column 3 > 10 then change the
back color to red instead of green. Is there a way to do
this.

Thanks,

Re: Conditional formating Eliyahu Goldin
11/28/2004 10:23:33 AM
Willem,

In code behind in PreRender event loop through the grid data rows. For every
row check value of column 3 and set formatting properties of another column.

Eliyahu

[quoted text, click to view]

Re: Conditional formating Nuno Fonseca
11/29/2004 2:37:07 PM
try to use the event item databound and in there check if the value of your
column is bigger then 10

something like this:

if ((int)e.Item.Cells[1].Text>10)
{
//want you want to do
}

[quoted text, click to view]

AddThis Social Bookmark Button