Repeater: Data Depended Format Change

A

Annick

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.DataItem,
"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
 

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,769
Messages
2,569,581
Members
45,056
Latest member
GlycogenSupporthealth

Latest Threads

Top