Conditional Formatting

J

jez123456

Hi Experts, I want to build a web page to display different coloured labels
depending on what data a record contains. Similar to a workflow diagram.

Thus if I have the flowing data

Name Letter Meeting Completed
Joe Blogs 01/03/2009 04/04/2009
Penny Smith 15/02/2009
David Smith 20/10/2009 03/01/2010 15/03/2010

3 labels would show on the web page (Letter, Meeting and Completed)

If data exists in the field then the label will be green otherwise the label
will be red.

For Joe Blogs, the Letter and Meeting labels will be green but the Completed
label will be Red

For Penny Smith, the Letter label will be green with the Meeting and
Completed labels will be Red

So for David Smith, all labels will be green.

Only one record is to be shown at a time ie I don’t want to use a datagrid
to show all records.

I’ve accomplished this in a little Access database using Conditional
Formatting but I don’t know if this is possible using ASP.Net.

Many thanks for your advice.
 
M

Mark Rae [MVP]

Only one record is to be shown at a time ie I don’t want to use a datagrid
to show all records.

I’ve accomplished this in a little Access database using Conditional
Formatting but I don’t know if this is possible using ASP.Net.

No problem at all. On the assumption that you will be using <asp:Label />
controls to present the data:

MyLabel.BackColor = (MyLabel.Text == "&nbsp;" || MyLabel.Text == "") ?
Color.Red : Color.Green;

Don't forget to include the System.Drawing namespace at the top of the code
behind page.
 

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,954
Messages
2,570,116
Members
46,704
Latest member
BernadineF

Latest Threads

Top