Solved

Change CssClass in asp.net

Posted on 2011-09-12
2
641 Views
Last Modified: 2012-06-27
I have a label, <asp:Label ID="lblInfo" runat="server" Text="" />, and I want to set the CssClass of the label to “RedText” if one condition is met and to “BlackText” if another condition is met.

This is in an asp.net using VB for the code behind.

Any Ideas?
0
Comment
Question by:us1975mc
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 29

Accepted Solution

by:
Paul Jackson earned 500 total points
ID: 36523966
Simply set the cssclass in the code behind:

If ....  Then
    lblInfo.CssClass = "RedText"
Else
    lblInfo.CssClass = "BlackText"
End If
0
 

Author Closing Comment

by:us1975mc
ID: 36524001
Thanks.  Great work and super fast!
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question