Solved

Change CssClass in asp.net

Posted on 2011-09-12
2
626 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
2 Comments
 
LVL 29

Accepted Solution

by:
Paul Jackson earned 500 total points
Comment Utility
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
Comment Utility
Thanks.  Great work and super fast!
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
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…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

762 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

Need Help in Real-Time?

Connect with top rated Experts

6 Experts available now in Live!

Get 1:1 Help Now