I would like to change the format of a cell depended on the value of
the data.
I wrote the following script, which works fine.
.. . .
Function function_ChangeFormat(ByVal value_01)
Dim decimal_temp As decimal
IF (value_01 Is Nothing)
function_ChangeFormat = 1.000
decimal_temp = 0
Else
decimal_temp = decimal.Parse(value_01)
End If
If (decimal_temp < 0)
function_ChangeFormat = " <font color = 'red' > " & value_01 & "
</font> "
Else
function_ChangeFormat = " <font color = 'black' > " & value_01 & "
</font> "
End If
End Function
.. . .
<ItemTemplate>
<tr style="font: 9pt verdana; background-color:#ffdab9">
<td>
<%# DataBinder.Eval(Container.DataItem, "K01") %>
</td>
<td>
<%# DataBinder.Eval(Container.DataItem, "K02") %>
</td>
<td style="font:9pt courier new">
<%# DataBinder.Eval(Container.DataItem, "K03") %>
</td>
<td>
<%# DataBinder.Eval(Container.DataItem, "K04") %>
</td>
<td>
<%# DataBinder.Eval(Container.DataItem, "K05") %>
</td>
<td>
<%# DataBinder.Eval(Container.DataItem, "K06") %>
</td>
<td>
<%# function_ChangeFormat(DataBinder.Eval(Container.Da taItem,
"K07")) %>
</td>
</tr>
</ItemTemplate>
.. . .
However I would also like to change the background color. The
following doesn't produce an error message but also doesn't work.
If (decimal_temp < 0)
function_ChangeFormat = " <font color = 'red' ><style
background-color = 'yellow'> " & value_01 & " </style></font> "
Else
function_ChangeFormat = " <font color = 'black' ><style
background-color = 'white'> " & value_01 & " </style></font> "
End If
Why doesn't it work? How do I get it to work?
Annick