Solved

Change CssClass in asp.net

Posted on 2011-09-12
2
634 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
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

Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
performance issue in asp web 5 34
VB.net Open Folder in Windows Explorer 3 31
RLDC Reporting in Visual studio 11 17
VB.NET 2008 - SQL Timeout 9 25
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

831 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