473,385 Members | 1,337 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Repeater: Data Depended Format Change

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
Nov 17 '05 #1
0 1135

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Dobedani | last post by:
Dear All, I would like to use a Repeater to show data - mostly large volumes from a database - in a comma delimited format. VS.NET documentation mentions this as one of the uses of the Repeater!...
8
by: Invalidlastname | last post by:
Hi, We are developing an asp.net application, and we dynamically created certain literal controls to represent some read-only text for certain editable controls. However, recently we found an issue...
2
by: GD | last post by:
I'd like to use a Repeater to display data coming back from a cross-tab report. Because it's a cross-tab, I generally don't know how many columns are coming back. They do follow a certain format: ...
2
by: Eniac | last post by:
*argh* ... *pull hairs* I've recently started developing from ASP to ASP.NET The switch was fairly smooth since i had done some VB.net before ... then came...FORMS! :) I find it astounding...
1
by: Timbo | last post by:
Hi all, This is my first message here so i'll try and include all the information that will help you help me out, if possible. Basically I am using C# in ASP.NET 2.0 and have a Repeater...
8
by: fernandezr | last post by:
I would like to use a user control as a template inside a repeater. Some of the fields in the control should be hidden depending on whether or not there is data. I'm still a ASP .Net newbie so the...
2
by: John Haycock | last post by:
Hi All I have a user control that uses a repeater to build a list of menu links: <itemtemplate> <li> <a href='news.aspx?newsID=<%# DataBinder.Eval(Container.DataItem,"newsID") %>'> <%#...
4
by: Michael | last post by:
I have a repeater web control. Currently I want to change some row's color based on defined condition. Is there any code sample demonstrating how to accomplish it? Thanks.
12
by: =?Utf-8?B?Qi4gQ2hlcm5pY2s=?= | last post by:
I'm doing a web app in VB/Dot Net 2.0. I'm probably a bit rusty and I have no experience using the repeater control. I have a user control I've created with multiple properties. I've created a...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.