Cells conditional formatting (i.e.Red for negative values)

S

Saverio Tedeschi

Hi all gurus,
I'd like to have a "Excel like" behaviour, like that of the subj. Is it
possible? I guess not, since I've found no similar solution. However, trying
in "DataBinding" or "PreRender" methods? Any clue much appreciated. Thanks
in advance.
 
E

Elton Wang

Try

e.Item.Cells[col_index].BackColor
e.Item.Cells[col_index].ForeColor
e.Item.BackColor
e.Item.ForeColor

in DataGrid_ItemDataBound event

HTH
 
S

Saverio Tedeschi

Works like a charm. Lot of thanks.

Elton Wang said:
Try

e.Item.Cells[col_index].BackColor
e.Item.Cells[col_index].ForeColor
e.Item.BackColor
e.Item.ForeColor

in DataGrid_ItemDataBound event

HTH


Saverio Tedeschi said:
Hi all gurus,
I'd like to have a "Excel like" behaviour, like that of the subj. Is it
possible? I guess not, since I've found no similar solution. However,
trying in "DataBinding" or "PreRender" methods? Any clue much
appreciated. Thanks in advance.
 
M

mkhmer

Hi, I got more related question on this too...

How can I track the first row in data grid?
I used this method to add "Click event" on each row....but you know? the
result is that even the Header Row (top row with field name) also effected
with that click event.

I want to exclude that Header Row from being added with "Click" event.

Code Here:
===============
e.Item.Attributes.Add("onclick", "javascript:WinObj=window.open(......))
===============

Please help.
Thanks,


Elton Wang said:
Try

e.Item.Cells[col_index].BackColor
e.Item.Cells[col_index].ForeColor
e.Item.BackColor
e.Item.ForeColor

in DataGrid_ItemDataBound event

HTH


Saverio Tedeschi said:
Hi all gurus,
I'd like to have a "Excel like" behaviour, like that of the subj. Is it
possible? I guess not, since I've found no similar solution. However,
trying in "DataBinding" or "PreRender" methods? Any clue much
appreciated. Thanks in advance.
 
E

Elton Wang

Using following condition in datagrid_ItemCreated or datagrid_ItemDataBound
event:

if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType ==
ListItemType.AlternatingItem )
{
e.Item.Attributes.Add( ...
}

HTH


mkhmer said:
Hi, I got more related question on this too...

How can I track the first row in data grid?
I used this method to add "Click event" on each row....but you know? the
result is that even the Header Row (top row with field name) also effected
with that click event.

I want to exclude that Header Row from being added with "Click" event.

Code Here:
===============
e.Item.Attributes.Add("onclick", "javascript:WinObj=window.open(......))
===============

Please help.
Thanks,


Elton Wang said:
Try

e.Item.Cells[col_index].BackColor
e.Item.Cells[col_index].ForeColor
e.Item.BackColor
e.Item.ForeColor

in DataGrid_ItemDataBound event

HTH


Saverio Tedeschi said:
Hi all gurus,
I'd like to have a "Excel like" behaviour, like that of the subj. Is it
possible? I guess not, since I've found no similar solution. However,
trying in "DataBinding" or "PreRender" methods? Any clue much
appreciated. Thanks in advance.
 
M

mkhmer

Wow....Great Thank for that...it work fine.

I got another issue now that the color format between IE and Netscap
browser....if you can help check it out for me:

e.Item.Attributes.Add("onmouseover" ,
"this.style.color='white';this.style.backgroundColor='gray';this.style.cursor='arrow';")
e.Item.Attributes.Add("onmouseout" ,
"this.style.color='black';this.style.backgroundColor='white';")

Netscap doesn't set my item color back into "black" and background into
"white" when I move out the move from eath item....but it work well in
IE....

Regards,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top