Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Development Tools
 ASP.NET
 Change string output text colors base on criteria?

Author  Topic 

chriskhan2000
Aged Yak Warrior

544 Posts

Posted - 2005-06-09 : 08:39:53
Is it possible to have strings output in different colors base on the result or criteria?

For example:

If strTest = "A" Then
strOutPut = "Execllent"
ElseIf strTest = "B" Then
strOutPut = "Good
ElseIf strTest = "C" Then
strOutPut = "Average"
ElseIf strTest = "D" Then
strOutPut = "Poor"
Else
strOutPut = "Failed"
End If

I want "Failed" to be in red, but not sure if it's possible to add colors or font format to this. Any ideas?

jhermiz

3564 Posts

Posted - 2005-06-09 : 08:57:29
A string doesnt have a color property, however a text box, item cell in a grid, listbox, ddl, etc..do.
So a color is simply a property you just need to set that property.

Jon



Keeping the web experience alive -- [url]http://www.web-impulse.com[/url]
Imperfection living for perfection --
[url]http://jhermiz.blogspot.com/[/url]
Go to Top of Page

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2005-06-09 : 11:29:00
do you mean you want a <font> tag?
"<font color=red>" + strOutPut + "</font>"

Go with the flow & have fun! Else fight the flow
Go to Top of Page

chriskhan2000
Aged Yak Warrior

544 Posts

Posted - 2005-06-10 : 17:17:11
I was thinking of programming the strings to have different colors from code behind.
Go to Top of Page

jhermiz

3564 Posts

Posted - 2005-06-12 : 00:51:18
Been a while but cant u just put javascript in the code behind ? I know i've done it.
Basically all you will be doing is a response.write...Ill get back to you considering I just got back and its 1am :|
zzzzzzz



Keeping the web experience alive -- [url]http://www.web-impulse.com[/url]
Imperfection living for perfection --
[url]http://jhermiz.blogspot.com/[/url]
Go to Top of Page
   

- Advertisement -