Forums

ASP

This topic is locked

Conditional Formatting

Posted 06 Jan 2006 14:05:03
1
has voted
06 Jan 2006 14:05:03 Barry James posted:
Hi,

I'm trying to do a simple jscript if-else statement based on data from a record set:

<%if ((loggedthisweek.Fields.Item("CallLogStatus".Value) = "Call closed"
{document.write('Open')}
else
{document.write('closed')}
%>

(I eventually want "Open" in green and Closed in "Red" but first things first)

The code above gives me the following error:
<i>Error Type:
ADODB.Field (0x800A0CB3)
Current Recordset does not support updating. This may be a limitation of the provider, or of the selected locktype.
/bmsonline/default.asp, line 233</i>

Replies

Replied 10 Jan 2006 11:43:14
10 Jan 2006 11:43:14 Lee Diggins replied:
Hi Barry

You need to change your if statement to have to equals signs == rather than one =. One means assign a value.

Sharing Knowledge Saves Valuable Time!!!
~ ~ ~ ~ ~ ~
<b>Lee Diggins</b> - <i>DMXzone Manager</i>
<font size="1">[ Studio MX/MX2004 | ASP -> VBScript/PerlScript/JavaScript | SQL | CSS ]</font>
Replied 10 Jan 2006 12:12:05
10 Jan 2006 12:12:05 Barry James replied:
Thanks Lee. Really appreciated

Barry
Replied 20 Apr 2008 05:44:30
20 Apr 2008 05:44:30 Carlos Rey replied:
Ok So now I know how to create the conditional peice....how do I change the cell collor, or at least the text color conditionally???

Thanks!!!

<BLOCKQUOTE id=quote><font size=1 face="Verdana, Arial, Helvetica" id=quote>quote:<hr height=1 noshade id=quote>

(I eventually want "Open" in green and Closed in "Red" but first things first)

The code above gives me the following error:
<i>Error Type:
ADODB.Field (0x800A0CB3)
Current Recordset does not support updating. This may be a limitation of the provider, or of the selected locktype.
/bmsonline/default.asp, line 233</i>
<hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote>
Replied 21 Apr 2008 11:48:52
21 Apr 2008 11:48:52 Lee Diggins replied:
Hey Carlos

Depends on waht elements you're targeting, post up some code so we know what you're dealing with.



Sharing Knowledge Saves Valuable Time!!!
~ ~ ~ ~ ~ ~
<b>Lee Diggins</b> - <i>DMXzone Manager</i>
<font size="1">[ Studio MX/MX2004 | ASP -> VBScript/PerlScript/JavaScript | SQL | CSS | C# | VS2005/8 | ASP.NET 2.0 ]</font>
Replied 21 Apr 2008 21:39:56
21 Apr 2008 21:39:56 Carlos Rey replied:
Thanks Lee for your reply....

Lee I'm trying to use the code from the first post here, and modify it to have either the field or the text change color.

I realize that the IF Statement requires some redefinition, but is the Then part that I have not been aboe to figure out.

Thanks again!!!!!
Replied 23 Apr 2008 11:48:20
23 Apr 2008 11:48:20 Lee Diggins replied:
Hi Carlos

There's many ways to an end, here's probably the most simplest:

<pre id=code><font face=courier size=2 id=code>var test;
var color;

test = true;

if (test)
{
color = "Green";
}
else
{
color = "Red";
}

document.write("&lt;span style=\"color: " + color + ";\"&gt;" + test.toString() + "&lt;/span&gt;";
</font id=code></pre id=code>

Sharing Knowledge Saves Valuable Time!!!
~ ~ ~ ~ ~ ~
<b>Lee Diggins</b> - <i>DMXzone Manager</i>
<font size="1">[ Studio MX/MX2004 | ASP -> VBScript/PerlScript/JavaScript | SQL | CSS | C# | VS2005/8 | ASP.NET 2.0 ]</font>
Replied 24 Apr 2008 14:27:44
24 Apr 2008 14:27:44 Carlos Rey replied:
Hi Lee!

thank you for the ifo. I will try it today.

Reply to this topic