Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
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 %>
Reply With Quote
  #2 (permalink)  
Old June 3rd, 2011, 05:47 AM
Friend of Wrox
Points: 2,473, Level: 20
Points: 2,473, Level: 20 Points: 2,473, Level: 20 Points: 2,473, Level: 20
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: May 2004
Location: India
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.
Reply With Quote
  #3 (permalink)  
Old June 3rd, 2011, 05:54 AM
Imar's Avatar
Wrox Author
Points: 72,055, Level: 100
Points: 72,055, Level: 100 Points: 72,055, Level: 100 Points: 72,055, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,086
Thanks: 80
Thanked 1,587 Times in 1,563 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!
Reply With Quote
  #4 (permalink)  
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
Reply With Quote
  #5 (permalink)  
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
Reply With Quote
  #6 (permalink)  
Old June 3rd, 2011, 05:47 PM
Imar's Avatar
Wrox Author
Points: 72,055, Level: 100
Points: 72,055, Level: 100 Points: 72,055, Level: 100 Points: 72,055, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,086
Thanks: 80
Thanked 1,587 Times in 1,563 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!
Reply With Quote
  #7 (permalink)  
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
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 12:52 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.