Wrox Programmer Forums
|
Classic ASP Professional For advanced coder questions in ASP 3. NOT for ASP.NET 1.0, 1.1, or 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Professional section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 3rd, 2011, 04:41 AM
ppenn
Guest
 
Posts: n/a
Default Change table background colour

Hi

The code I am using is listed below, my problem is that it will work when running as localhost on my laptop but will not work when running on the server.

I want the code to change the background colour of a table according to the profit or loss in a contract. The figure is obtained from a query and then I assign this value to a variable "profitloss" and then depending on the value change the colour accordingly.

As I said earlier I cannot understand why it work on my laptop but not the server. Is there a setting within IIS or is my code wrong?

Thanks for any help

Peter

Part of code as follows:

oRs.Open strSQL, conn
While Not oRs.EOF
profitloss=oRs("PL")
bgPL="#2008FD"
%>
<form name="frmResult">
<%

IF profitloss < -1000.00 THEN %>
<table border="1" width="848" bgcolor="#FBA2A8" cellpadding="1" cellspacing="1">
<tr>
<td colspan="4" align="center"><font size="4" color="<%=bgPL%>" ><b><%=oRs("Operator")%></b></font></td>
</tr>
<tr>
<td width="50%" align="center"><font size="4" color="<%=bgPL%>"><b><%=oRs("REG NO")%></b></font></td>
<td width="50%" align="center"><font size="4" color="<%=bgPL%>"><b><%=oRs("CONT TYPE")%></b></font></td>
</tr>
</table>

<% ELSEIF profitloss > -1000.00 THEN %>
<table border="1" width="848" bgcolor="#91FB88" cellpadding="1" cellspacing="1">
<tr>
<td colspan="4" align="center"><font size="4" color="<%=bgPL%>"><b><%=oRs("Operator")%></b></font></td>
</tr>
<tr>
<td width="50%" align="center"><font size="4" color="<%=bgPL%>"><b><%=oRs("REG NO")%></b></font></td>
<td width="50%" align="center"><font size="4" color="<%=bgPL%>"><b><%=oRs("CONT TYPE")%></b></font></td>
</tr>
</table>
<% ELSE %>

<table border="1" width="848" bgcolor="#FCFBFB" cellpadding="1" cellspacing="1">
<tr>
<td colspan="4" align="center"><font size="4" color="<%=bgPL%>"><b><%=oRs("Operator")%></b></font></td>
</tr>
<tr>
<td width="50%" align="center"><font size="4" color="<%=bgPL%>"><b><%=oRs("REG NO")%></b></font></td>
<td width="50%" align="center"><font size="4" color="<%=bgPL%>"><b><%=oRs("CONT TYPE")%></b></font></td>
</tr>
</table>

<% END IF %>
 
Old June 3rd, 2011, 05:47 AM
Friend of Wrox
 
Join Date: May 2004
Posts: 642
Thanks: 0
Thanked 43 Times in 42 Posts
Default

Try using
<table style="background-color:#FBA2A8">
instead of
bgcolor="#FBA2A8"
__________________
Om Prakash Pant
Click the "Thanks" button if this post helped you.
 
Old June 3rd, 2011, 05:54 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Could there be a difference in Regional settings on your machine and the server?

Maybe -1000.00 is seen as different numbers on each machine?

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
 
Old June 3rd, 2011, 06:46 AM
ppenn
Guest
 
Posts: n/a
Default Change table background colour

Hi

I have changed the table style as suggested but again it will work on the laptop but not the server.

It seems that the server will change the background colours as follows

If the record does not fit either criteria ie else statement the background is correct as white.

When the record matches either of the other criteria it will only change the background to the first option ie red.

It seems that the variable "profitloss" is not clearing

Peter
 
Old June 3rd, 2011, 09:59 AM
ppenn
Guest
 
Posts: n/a
Default

Hi

I have just added into the code the following

Response.Write("profitloss = " & profitloss & "")

On my laptop it shows the value of the query, but on the server it only shows a zero.

So for some reason the variable is not being assigned the value on the server

Has anyone any ideas please, I have checked the number formats on the server are the same

Regards
Peter
 
Old June 3rd, 2011, 05:47 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi Peter,

Since that value is coming from the database, there might be an issue with your query or data.....

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
 
Old June 6th, 2011, 02:51 AM
ppenn
Guest
 
Posts: n/a
Default

Hi Imar

Thanks very much for all your help - the problem was the data format, the website database is a replica of the main data, I did a resync and it worked okay, something must have occurred with an earlier sync.

Thanks again
Peter





Similar Threads
Thread Thread Starter Forum Replies Last Post
background colour of page adamhw Javascript How-To 3 October 25th, 2010 01:03 PM
Table row background colour changing meetravig Java GUI 0 September 21st, 2007 05:06 AM
Background colour/image printing ghari HTML Code Clinic 0 September 21st, 2006 01:05 PM
How to custom-define the default background colour ms_priya Java GUI 1 January 10th, 2006 05:28 PM
Setting backGround Colour of a text pazzuzu C++ Programming 0 January 21st, 2005 11:15 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.