Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Set formatting (color) on a literal or label

Reply
Thread Tools

Set formatting (color) on a literal or label

 
 
=?Utf-8?B?RGF2aWQgVGhpZWxlbg==?=
Guest
Posts: n/a
 
      03-09-2006
We have a status message we display that can be good news (in green) or bad
news (in red). Is there a way to do this for a single literal or label? Or do
we need to have two, one set to green and one to red and just set one to a
text string and the other to ""?

--
thanks - dave
david_at_windward_dot_net
http://www.windwardreports.com

 
Reply With Quote
 
 
 
 
Elliot Rodriguez
Guest
Posts: n/a
 
      03-09-2006
Dim GoodNews as Boolean
.....
If GoodNews Then
MessageLabel.Font.Color = Color.Green
Else
MessageLabel.Font.Color = Color.Red
End If



"David Thielen" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> We have a status message we display that can be good news (in green) or
> bad
> news (in red). Is there a way to do this for a single literal or label? Or
> do
> we need to have two, one set to green and one to red and just set one to a
> text string and the other to ""?
>
> --
> thanks - dave
> david_at_windward_dot_net
> http://www.windwardreports.com
>



 
Reply With Quote
 
 
 
 
=?Utf-8?B?UGhpbGxpcCBXaWxsaWFtcw==?=
Guest
Posts: n/a
 
      03-09-2006

If you do it using a Literal you can set the Text property to the complete
markup e.g.
If GoodNews Then
Literal1.Text = "<span class='greencolorCss'>this is the status
for good news </span>"
Else
Literal1.Text = "<span class='redcolorCss'>this is the status
for bad news </span>"
End If

If you do it using a Label you might write:
If GoodNews Then
Label1.CssClass = "greencolorCss"
Label1.Text = "This is the status for good news"

Else
Label1.CssClass = "redcolorCss"
Label1.Text = "This is the status for bad news"
End If
--
HTH,
Phillip Williams
http://www.societopia.net
http://www.webswapp.com


"David Thielen" wrote:

> We have a status message we display that can be good news (in green) or bad
> news (in red). Is there a way to do this for a single literal or label? Or do
> we need to have two, one set to green and one to red and just set one to a
> text string and the other to ""?
>
> --
> thanks - dave
> david_at_windward_dot_net
> http://www.windwardreports.com
>

 
Reply With Quote
 
 
 
Reply

Thread Tools

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Literal vs. LiteralControl vs. Label =?Utf-8?B?Sm9l?= ASP .Net 7 12-30-2008 04:22 PM
LinkButton to Label/Literal rn5a@rediffmail.com ASP .Net 1 11-10-2006 06:08 PM
Label versus Literal shapper ASP .Net 4 09-23-2006 02:47 PM
literal or label for error message =?Utf-8?B?RGF2aWQgVGhpZWxlbg==?= ASP .Net 2 03-09-2006 09:58 PM
What's wrong with rpc-literal? Why use doc-literal? Anonieko Ramos ASP .Net Web Services 0 09-27-2004 09:06 AM



Advertisments