This topic is locked

How to change row color programmatically - Tips and tricks Area

10/11/2007 6:12:17 PM
ASPRunnerPro General questions
Alberto author

Is this just a copy and paste thing? I did that but can't make it work yet. <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=question&id=6491&image=1&table=forumtopics' class='bbc_emoticon' alt=':blink:' />
I am using Built 275 and trying to change the row style based on the value of one of the columns. If it is not for the 275 how should this be done in this case?
Thanks a lot <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=question&id=6491&image=2&table=forumtopics' class='bbc_emoticon' alt=':rolleyes:' />

Sergey Kornilov admin 10/12/2007

Alberto,
I suggest you to get the latest build.

If this doesn't help tell me what exactly you doing and what results or errors you getting.

Alberto author 10/12/2007

I copy and Paste this in :
List Page: After Record Procesed, Didn't work so then I tried it in List Page: Before Display but got same error below.
'** Custom code ****

' put your custom code here

$row["rowstyle"]='style="background:blue"';
Web Page Error

============

Microsoft VBScript compilation error '800a0408'

Invalid character

/ICPbyNearestOfficeMedia/include/BT_MKTG_ICP_BY_NEARESTOFFICE_MEDIATYPE_events.asp, line 25

$row["rowstyle"]='style="background:blue"';

^
WHAT I REALLY NEED TO DO IS TO BOLD and change the color to the whole row when one of the fields has a specific value.

Thanks

Sergey Kornilov admin 10/12/2007

Oops, my bad. That was an example for PHPRunner. It's fixed now.
Here is the correct syntax:

row("shadeclass")="style='background:blue'"
Alberto author 10/15/2007

It works perfect!!!
Now this is an example on how to do it. I am trying to find out how to make something friendly like:

  1. Other colors
  2. How to do Bold
  3. How to change the size of the text

    4) HOW TO DO THIS BASED ON THE VALUE OF 1 OR MORE COLUMNS? (Here is the real value for me otherwise we can do it using visual editor)
    THANKS <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=22248&image=1&table=forumreplies' class='bbc_emoticon' alt=':rolleyes:' />

A
ac163601 10/15/2007

Alberto, I had the same sort of questions. Have a look through this, it should help with most of your queries
http://www.asprunner.com/forums/index.php?showtopic=6383
cheers

Shand

Alberto author 10/15/2007

Thank you Shandy this is great but it works in the visual editor only I think.
I need what needs to be done in the events area. Also we need this to be based on the values of other fields, not necessary only in the current one.

Thanks
Check this one <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=22265&image=1&table=forumreplies' class='bbc_emoticon' alt=':unsure:' /> We need this based on the value of 1 or more cells

http://www.asprunner.com/forums/index.php?showtopic=6412

Alberto author 10/19/2007

How could this be done? to condition the change of the color based on the value of one or more fields

Thanks

Sergey Kornilov admin 10/19/2007

You need to clarify what changes you talking about as you mixing all together.
To change the row background color you need to use After Record Procesed event.

To change the font of any specific field you need to set View as type of this field to Custom.

In Custom code you can use rs("FieldName") to access any field value.

Alberto author 10/19/2007

Thanks!!!

And in After Record Procesed can we users("FieldName")too?
Example:
IF rs("FieldName1") = 1 and rs("FieldName2") = 2 the

change background color or Bold, etc

end
Thanks

E
ebolisa 10/20/2007

Alberto,

I used the following code to change the color of the row under 'After Record Processed' but it's not working. If you find the solucion, pls post it.

Thank you.
if rs("fieldname") = y then

row("shadeclass")="style='background:red'"

else

""

Sergey Kornilov admin 10/20/2007

if rs("fieldname") = "y" then

row("shadeclass")="style='background:red'"

else

...
Also you need to replace field name with the actual field name.